Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grid in xzplane

Tags:

gnuplot

I'm having trouble with displaying a grid in the xzplane. I've changed the position of my z-axis like this:

Now I'd like to have a grid like in the xy-plane in my xz-plane, but since I'm rather new to gnuplot, I couldn't find the correct command.


My code looks like this:

set parametric

set xlabel "Abweichung"
set ylabel "Dosis [%]"
set zlabel "Volumen [%]"

set xrange [-1:1]
set yrange [0:100]
set zrange [0:100]

set xtics 0.2
set ytics 10
set ztics 10

set grid 

set border 4095 ls 1 lc rgb "black"

set xtics axis
set ytics axis
set ztics axis

set xzeroaxis lt 1 lw 2 lc rgb "black"
set yzeroaxis lt 1 lw 2 lc rgb "black"
set zzeroaxis lt 1 lw 2 lc rgb "black"

set xyplane 0

splot [t=0:100] 0, t, t
like image 300
Schnigges Avatar asked Apr 26 '13 15:04

Schnigges


2 Answers

This works in gnuplot 4.6:

set grid ztics

Have a look at this article: http://gnuplot.sourceforge.net/docs_4.2/node188.html

And for a complicated example: http://www.phyast.pitt.edu/~zov1/gnuplot/html/bargraphs.html

like image 160
stormCloud Avatar answered Nov 13 '22 11:11

stormCloud


Sadly this is currently not supported by the grid command, a feature request should probably be posted.

Anyway, as suggested by mgilson you can manually add the grid-lines with for-loops and the set arrow command. For example adding the following two lines:

set for [x = -10:10:2] arrow from x/10.0, 0, 0 to x/10.0, 0, 100 nohead lt 0
set for [z = 0:100:10] arrow from     -1, 0, z to      1, 0,   z nohead lt 0

Results in:

Plot that includes XZ grid

You may want to rotate the plot with set view. The divide-by-ten is there because floating-point increment doesn't seem to work.

Or if you wanted the grids to be on the back of the box, do something like this:

set for [x = -10:10:2] arrow from x/10.0, 100, 0 to x/10.0, 100, 100 nohead lt 0
set for [z = 0:100:10] arrow from     -1, 100, z to      1, 100,   z nohead lt 0

set for [y = 0:100:10] arrow from     -1,   y, 0 to -1,   y, 100 nohead lt 0
set for [z = 0:100:10] arrow from     -1,   0, z to -1, 100,   z nohead lt 0

Which results in:

Plot that includes grid at the back of the two walls of the plot

A style note

You can replace:

set xtics axis
set ytics axis
set ztics axis

set xzeroaxis lt 1 lw 2 lc rgb "black"
set yzeroaxis lt 1 lw 2 lc rgb "black"
set zzeroaxis lt 1 lw 2 lc rgb "black"

with the equivalent:

set tics axis
set zeroaxis lt 1 lw 2 lc rgb "black"
like image 33
Thor Avatar answered Nov 13 '22 11:11

Thor