I have this data1.dat data that I'd plot using gnuplot.
x y
0.007 3.09216
0.008 3.60607
0.009 5.86643
then I tried to plot this with this plot script
set terminal svg size 400,300 enhanced fname 'arial'
set output 'out2.png'
set xlabel 'diameter'
set ylabel 'number density'
set title 'density number plot'
plot "data1.dat" using 3:4 title "" with lines
and the output in the x axis was like this
how to convert the number data on the x axis so it only shows only for example 7 or 8 only? this is an example and probably my data would getting bigger, so i can't change the data on data1.dat one by one in the x column, thanks in advance
Apparently, gnuplot's tic algorithm doesn't take the length of the ticlabels into account. That's why the numbers are overlapping. You can do the following:
set the xtic increment manually to avoid overlap, e.g. set xtic 0.0005
multiply your values by a factor, e.g. 1000, especially if you have meters you can display millimeters, i.e. ($1*1000)
which is identical to (column(1)*1000)
.
Code:
### avoid overlap of tic labels
reset session
$Data <<EOD
x y
0.007 3.09216
0.008 3.60607
0.009 5.86643
EOD
set ytics 1
set multiplot layout 3,1
set xlabel 'diameter / m'
plot $Data using 1:2 w l notitle
set xlabel 'diameter / m'
set xtic 0.0005
plot $Data using 1:2 w l notitle
set xlabel 'diameter / mm'
set xtics 0.2
plot $Data using ($1*1000):2 w l notitle
unset multiplot
### end of code
Result: