yak
yak

Reputation: 3930

Gnuplot 3D plotting from file, not enough detailed values on x-,y-, and z-ticks

I have a simple data I want to plot as 3D plot (3 columns divided by a comma):

33.26,0.0000001,1
67.02,0.0000010,2
101.64,0.0000100,3
137.53,0.0001000,4
175.06,0.0010000,5
214.59,0.0100000,6
256.47,0.1000000,7
301.09,1.0000000,8
348.78,10.0000000,9
399.92,100.0000000,10
454.87,1000.0000000,11
513.99,10000.0000000,12
577.65,10000.0000000,13
646.22,10000.0000000,14
720.05,10000.0000000,15
799.51,10000.0000000,16
884.96,10000.0000000,17
976.77,10000.0000000,18
1075.29,10000.0000000,19
1180.89,10000.0000000,20
1293.92,10000.0000000,21
1414.77,10000.0000000,22
1431.83,10000.0000000,23
1449.15,10000.0000000,24
1466.97,10000.0000000,25
1485.79,10000.0000000,26
1505.97,10000.0000000,27
1527.88,10000.0000000,28
1551.87,10000.0000000,29
1578.3,10000.0000000,30
1607.56,10000.0000000,31
1639.98,10000.0000000,32
1675.95,10000.0000000,33
1715.82,10000.0000000,34
1759.96,10000.0000000,35
1808.72,10000.0000000,36
1862.49,10000.0000000,37
1921.6,10000.0000000,38
1986.44,10000.0000000,39
2057.35,10000.0000000,40
2134.71,10000.0000000,41
2218.87,10000.0000000,42
2310.2,10000.0000000,43
2409.06,10000.0000000,44
2515.83,10000.0000000,45

I wrote a simple script to plot the above data:

#!/usr/bin/gnuplot

set palette rgbformulae 33,13,10
set datafile separator ","

set terminal postscript eps size 10.5, 5.62 enhanced color font 'Helvetica,20' linewidth 2
set output 'test.eps'

set xlabel "time [s] (no operation)" offset -4, 0, 0
set xtics left offset 0,-0.3 rotate by 45 right
set xrange [0:400]

set ylabel "ranges" offset 2, 0, 0
set ytics left offset 0,-0.5

set zlabel "devices" offset -4, 0, 0 
set zrange [0:50]
set autoscale

set title " "
set key inside left top;

set dgrid3d 30,30
set hidden3d

set style line 1 linecolor rgb '00FF00'  linetype 4 linewidth 1 

splot "data.csv" u 1:2:3 title "" with lines  palette 

And my output:

enter image description here

As you all can see, the output image (or, I should say), the x,y and z ticks on axis x,y, and z are not enough detailed. It is hard to say that the output image was plotted with this data.

Is there a way that would let me manipulate the x,y, and z ticks, to be taken from file, in some elegant way?

I also would like the image to be more readable with new x,y, and z ticks, so I think that the 10000.0000000 value should appear only once, when it appeared for the first time in data file.

Thank you.

Upvotes: 2

Views: 3164

Answers (1)

maij
maij

Reputation: 4218

Not exactly an answer to your question, and it is my personal opinion, but you might be interested in the ideas:

  • The data seems not to be grid data, so I would not use a surface plot of any kind.
  • Plotting only the datapoints in 3d does not give a useful picture, it is only a single line somewhere in space. I would try to use a 2D plot which contains the height information as color.
  • I would use a logscale for the y-axis.

This leads to the following script:

set terminal pngcairo
set output 'test.png'

set datafile separator ","
set palette rgbformulae 33,13,10

# Set margins to keep colorbox label inside the picture
set lmargin screen 0.12
set rmargin screen 0.85

set xlabel "time [s] (no operation)"
set ylabel "ranges"
set cblabel "devices"

unset key

set yrange  [1e-8:1e5]
set ytics format "1e%+T"
set logscale y

set view map
set cbrange [0:50]
set zrange [0:50]

splot "data.csv" u 1:2:3 w p pt 7 palette ,\
      "data.csv" every 5::4 u ($1+0):($2/3):(0):($3 != 30 ? 3 : "") with labels

It also prints the z-labels of some datapoints, skipping 30 for spacing reasons.

This is the result:

enter image description here

Upvotes: 2

Related Questions