Techniques in Gnuplot

Thousands separator

How to get a thousands separator in numbers, such as on the y-axis.

set decimalsign locale ""
set format y "%'g"

The empty string for locale tries to load the default locale from the LC_TIME, LC_ALL or LANG environment variables. The the apostrophe in the format string causes the locale default thousands separator, generally a comma or a full stop (period) to be used.

Summing values from separate data blocks

Date like:


$Years << DATA
2019 10
2020 11
2021 14


2020 40
2021 15
DATA
set table $Combined
plot $Years using ($1):($2) with table
unset table

Now the summed values can be plotted:

plot $Combined using ($1):($2) with points smooth frequency