The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

425514 (7) [Avatar] Offline
#1
I have 3d data where I want two axes to have equal scale.
For example, x and y span -1 to +1, and I want them to have equal scale.
As for z, it ranges from 0 to 100.
splot will draw the plot I want, but I cannot orient it the way I want.
I need the z axis to run sideways across the plot, but I can't get it to do this.

If I instead put the 0:100 data along the x axis, I can orient the plot as I want it, but there is no option for yz to be equal scale.

Is there a way to orient the z axis to the left or right, or else make the yz axes be equal scale?
philipp.janert (286) [Avatar] Offline
#2
Maybe the simplest thing is to fix the plot ranges for all three axes explicitly:

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

You can also fix the ranges inline:

splot [-1:1][-1:1][0:100] ...
425514 (7) [Avatar] Offline
#3
3dplot
[ 7 KB ]
Thanks for the reply, Phillip.
But if I do that, how do I orient the plot like the attached image from Mathcad?
philipp.janert (286) [Avatar] Offline
#4
You change the view point using "set view".

The most intuitive way to adjust the view point is by "grabbing the graph" by clicking into an opened interactive terminal with the mouse, and then moving the mouse. The view point is displayed at the bottom of the terminal window.

If you do this, you will find that gnuplot will always keep the "z" axis pointing vertically up - after all, the idea of "splot" is to plot a surface rising up from some base plane.

Your example graph seems to be parametric, hence nothing should stop you from relabeling (!) what would be the x-axis as the z-axis (and vice versa). Then adjust the view point as desired, either using "set view" or the mouse. (You may need to interchange variables in your plot/splot command as well.)

You may also want to turn off some of the edges of the box surrounding the plot - you do this using "set border", by supplying a bit mask that tells gnuplot which edges to retain.
425514 (7) [Avatar] Offline
#5
Restraining the z axis to always be verticalish makes sense in some certain situations, but not all.
It's preventing me from getting the plot I want because of other limitations (e.g. no equal yz option).
Gnuplot is the only 3d plotting software I've ever seen that doesn't allow fully arbitrary orientation.
If I could build gnuplot with Microsoft visual studio, I would take a shot at fixing that.