From: Ethan M. (UW) <me...@uw...> - 2019-09-18 18:52:56
|
On Wednesday, 18 September 2019 10:37:15 Dima Kogan wrote: > Hi. I'm trying to make a plot that's not working because I'm running > into some assumptions gnuplot is making. Help sought. > > I want to make a 3D plot that contains contours on the xyplane AND ALSO > contains other data (points, say) in the xyz space. The contours are > rendered on the z=0 plane, so from the plot viewer's perspective this is > unrelated to the z axis in the plot. So I want the data on the z axis to > be decoupled from the data used to make the contours. Are you saying that you have two sets of data, each with its own range on z? That is a separate problem I will come back to at the end [*]. For now I assume the two data sets are on the same scale. > > Example. I can make contours from a sinusoid: > > set contour base > set cntrparam levels incremental -1,0.1,1 > set samples 100,100 > set isosamples 100,100 > splot [-5:5][-5:5] '++' using 1:2:(sin($1)*cos($2)) with lines nosurface > > This works great. It generates a 3D plot with the contours rendered on > the z=0 plane only. Let's pretend I have other data plotted also, and > for whatever reason I also want to > > set zrange [0:0.5] > > This breaks the contours! It looks like the zrange limit is applied to > the data before generating the contours, which sounds counter-intuitive > to me. The contour plot is generated by contouring the data. If you restrict the data to the subset in a particular range then you get contours of only that subset. > Any suggestions about how to decouple this? Can we always use > zrange [*:*] for the purposes of contour generation? Should we? I do not understand what you are asking for. If you want to contour all the data then autoscaling z is appropriate. If you want to contour a subset of the data then you have two options: 1) restrict the range of the data set zrange [min:max] 2) keep the full range of data but restrict the range of contours set zrange [*:*] set cntrparam levels incremental min, increment, max If you want to superimpose data points outside the min:max range then option 1 will not work but option 2 does work. [*] If the two data sets are not on the same scale then a different approach is needed. Gnuplot does not currently have a separate z2 axis analogous to x2 or y2. You can, however, introduce a scaling function into the plot command: splot $data1 using 1:2:3 with lines nosurface title "contours", \ $data2 using 1:2:(scale($3)) with points nocontour However the commands as shown would leave you with the wrong labels along z. If you apply the scale to the contoured data instead then the z axis labels would be correct but the contour labels would be wrong. Either way you would have to manually correct the values in the labels. Modifying gnuplot to support a z2 axis would be possible, but we'd have to agree on the desired representation. x2 and y2 are drawn on the opposite side of the plot from x1 and y1 respectively. Would z2 be drawn on a separate [new] vertical line from z1? Or would z2 consist only of a second set of z-axis tic labels, presumably in a distinct color? Ethan |