From: Lutz M. <ma...@uc...> - 2004-06-04 18:46:34
|
I noticed the following behavior in gnuplot 4.0 under linux: In a new gnuplot session, copy&paste the following command: set term post; set outp 'test.ps'; set multiplot; set size 1,0.5; set origin 0,0.5; splot x**2+y**2; set origin 0,0; splot x**2+y**2; unset multiplot; set outp This will create a postscript file "test.ps", which contains two plots as expected. Now execute this line again. The resulting postscript file contains only one plot. Is this the expected behavior? Lutz |
From: Ethan M. <merritt@u.washington.edu> - 2004-06-04 19:59:29
|
On Friday 04 June 2004 11:45 am, Lutz Maibaum wrote: > I noticed the following behavior in gnuplot 4.0 under linux: In a new > gnuplot session, copy&paste the following command: > > set term post; set outp 'test.ps'; set multiplot; set size 1,0.5; set > origin 0,0.5; splot x**2+y**2; set origin 0,0; splot x**2+y**2; unset > multiplot; set outp > > This will create a postscript file "test.ps", which contains two plots > as expected. Now execute this line again. The resulting postscript file > contains only one plot. Is this the expected behavior? Yes, I believe it is the expected behaviour. At the time of your first 'set output' the size was set to 1,1 so you created a full-size plot canvas. That is, the bounding box encompassed the entire page. Later you set the size to 1,0.5 At the time of your second 'set output' the size was still set to 1,0.5 and so you created only a half-size plot canvas. If you look at the second postscript file you will see that both of your plots are there; it's just that one of them is drawn onto the half of the page that is outside the bounding box. -- Ethan A Merritt merritt@u.washington.edu Biomolecular Structure Center Mailstop 357742 University of Washington, Seattle, WA 98195 |
From: Lutz M. <ma...@uc...> - 2004-06-04 21:02:02
|
Thank you very much for your explanations, Ethan and Hans. It seems that the "size" setting has very different effects when evaluated by "set multiplot" and by the plot command. It would be nice if this dual meaning could be mentioned in the help entry of "set size". Lutz |
From: Daniel J S. <dan...@ie...> - 2004-06-05 16:25:17
|
Lutz Maibaum wrote: >Thank you very much for your explanations, Ethan and Hans. It seems that the >"size" setting has very different effects when evaluated by "set multiplot" >and by the plot command. It would be nice if this dual meaning could be >mentioned in the help entry of "set size". > > Lutz > > Since this topic has come up... I've thought for a while that a tutorial of plot layout would be a nice thing. Something that illustrates the view, how size behaves, how coordinates behave, how labels get placed, etc. But I'll put that in the "longterm" bin, i.e., maybe if ever some free time. Anyway, the immediate issue is the difficulty in which to get multiplots laid out in anything but the default manner. I'll give an example to illustrate the frustration. I recently created a plot for which I wanted the following 1) 6 x 1 configuration, i.e., six plots stacked vertically. 2) Tic marks outside the borders because otherwise they would interfere with what is in the plot. 3) All six plots share the same x-axis. Hence, to free up space, I wanted only the bottom plot to have units and tic marks. 4) I wanted just one y-axis label, centered somewhere between the third and fourth plots. OK, it is #3 that really poses the problem. Here is a string of commands that basically captures the ideas I used to lay out the multiplot: set multiplot unset key unset xlabel unset xtics set tics out set size 0.95,0.3 set origin 0.05,0.7 plot sin(x) set origin 0.05,0.4 plot sin(x+0.78540) set origin 0.05,0.0 set xtics nomirror set xlabel "time (s)" set label 1 "amplitude" at screen 0.03,0.53 center rotate front plot sin(x+1.5708) unset multiplot However, I had to do some tweaking of dimensions, but I left that undone here for illustration. If you enter these commands, you'll see what the main issue is. That bottom plot is different in terms of label configuration. The way gnuplot works, when one says "size" it refers to the overall dimension of the plot *including* labels. Hence, that bottom plot comes out smaller than all the rest. No problem, you say. Just issue a different size for the bottom plot, maybe set size 0.95,0.4 Sure, but try it. The trial an error process soon got the best of me. You want the borders to be the same dimension (adjusting "size"), and you want the spacing between plots to be just right (adjusting "origin"), and you want the xlabel to not go too far off the view (adjusting "size" and "origin" again). One could remove the xlabel and instead put another "label 2", but there is still the units and tics. OK, if you've looked at the result of the commands above, you can imagine tweaking things with relative ease to get it to look right. But now try getting things as you want using the "pslatex" terminal. This isn't WYSIWYG, so it is the whole process over again; and this time one has to generate pslatex, compile tex, generate pslatex, compile tex, etc. And you sort of need the X11 layout as a guide. If you compare the layout parameters for proper pslatex layout, the X11 view looks like a mish-mash of overlapping plots and labels. I eventually got what I wanted, and it looks great. But it sure took enough time. Bottom line: can anyone think of a syntax and scheme that would allow better control for this? For example, just as "coordinates" have a "system" reference (i.e., `first`, `second`, `graph` or `screen`) could it be possible for "size" to reference 'border' or 'overall' or something like that. The idea would be for some way to have the borders of your plots be exactly the size you specify. I don't think I'm overlooking anything that would have made life simple here. Thoughts? Dan |
From: Daniel J S. <dan...@ie...> - 2004-06-05 19:50:11
|
Daniel J Sebald wrote: > Bottom line: can anyone think of a syntax and scheme that would allow > better control for this? For example, just as "coordinates" have a > "system" reference (i.e., `first`, `second`, `graph` or `screen`) > could it be possible for "size" to reference 'border' or 'overall' or > something like that. The idea would be for some way to have the > borders of your plots be exactly the size you specify. I don't think > I'm overlooking anything that would have made life simple here. > Thoughts? Hold on. Maybe I did overlook an alternative. One can solve the unequal borders problem by creating a phantom tic/unit for the top plots and placing a label for the bottom xlabel. I.e., set multiplot unset key unset xlabel set xtics nomirror set xtics ("" 1e100) set tics out set size 0.95,0.35 set origin 0.05,0.6 plot sin(x) set origin 0.05,0.315 plot sin(x+0.78540) set origin 0.05,0.03 set xtics autofreq set label 1 "amplitude" at screen 0.03,0.53 center rotate front set label 2 "time (s)" at screen 0.53,0.03 center front plot sin(x+1.5708) unset multiplot I'll just mumble to myself here for a while... Dan |
From: Ethan A M. <merritt@u.washington.edu> - 2004-06-06 04:58:00
|
On Saturday 05 June 2004 09:47 am, Daniel J Sebald wrote: > > Anyway, the immediate issue is the difficulty in which to get multiplots > laid out in anything but the default manner. [snip example of stacked plots] > Bottom line: can anyone think of a syntax and scheme that would allow > better control for this? I think we already have it. set {b|l|r}margin 0 That should line all the plots up regardless of labels or tics, at the cost of having to explicitly position them in from the page boundary. One remaining issue for such stacked plots, however, is trying to collect all of the plot labels into a single key. I can't think of an easy way to do that. Is there something else missing? -- Ethan A Merritt Department of Biochemistry & Biomolecular Structure Center University of Washington, Seattle |
From: Daniel J S. <dan...@ie...> - 2004-06-06 06:12:01
|
Ethan A Merritt wrote: >On Saturday 05 June 2004 09:47 am, Daniel J Sebald wrote: > > >>Anyway, the immediate issue is the difficulty in which to get multiplots >>laid out in anything but the default manner. >> >> > >[snip example of stacked plots] > > > >>Bottom line: can anyone think of a syntax and scheme that would allow >>better control for this? >> >> > >I think we already have it. > set {b|l|r}margin 0 > >That should line all the plots up regardless of labels or tics, >at the cost of having to explicitly position them in from the page >boundary. > Right... This is the kind of thing there should be a 5 page tutorial for, or a demo. Something titled "Plot Layout". >One remaining issue for such stacked plots, however, is trying >to collect all of the plot labels into a single key. I can't think of >an easy way to do that. > That is a problem. But in this case it was a bunch of stacked histograms, i.e., no real white space within the plots. So the key would cover up some information, and not really provide anything useful. >Is there something else missing? > No, I think that does the trick. Thanks Ethan. Dan |
From: Ethan M. <merritt@u.washington.edu> - 2004-06-04 21:18:39
|
On Friday 04 June 2004 12:59 pm, Ethan Merritt wrote: > >The resulting postscript > > file contains only one plot. Is this the expected behavior? > > Yes, I believe it is the expected behaviour. On the other hand, I think it would be reasonable for set/unset multiplot to save and restore the plot size. Logically it should then also save and restore the origin. Is that what you expected to happen? -- Ethan A Merritt merritt@u.washington.edu Biomolecular Structure Center Mailstop 357742 University of Washington, Seattle, WA 98195 |
From: Lutz M. <ma...@uc...> - 2004-06-04 23:57:06
|
On Friday 04 June 2004 14:18, Ethan Merritt wrote: > On the other hand, I think it would be reasonable for > set/unset multiplot to save and restore the plot size. > Logically it should then also save and restore the > origin. > > Is that what you expected to happen? I'm not sure I understand your question. The way I use gnuplot, I would have expected the following (I will use the word "canvas" for the output medium, it could be an X window, or a sheet of paper. I think this is equivalent to the "screen" coordinate system in gnuplot): "set multiplot": tells the plot command that the canvas shouldn't be cleared before the plot. "set size xscale, yscale": tells the plot command that the whole plot should be scaled in x- and y-direction. "set size 1,1" means using the whole canvas. "set origin x,y": tells the plot command to shift the plot by (x,y), where (0,0) is the bottom left and (1,1) is the top right corner of the canvas. If I wanted to change the canvas size (for example, the resolution of a bitmap plot, or the paper size), I would expect this to be done using "set terminal <whatever> <canvas size>". Lutz |
From: Ethan A M. <merritt@u.washington.edu> - 2004-06-05 04:54:46
|
On Friday 04 June 2004 04:56 pm, you wrote: I'm not sure I can make things any clearer, but I'll try. > The way I use gnuplot, I would have expected the following. > "set multiplot": tells the plot command that the canvas shouldn't be > cleared before the plot. Not quite correct. "set multiplot" tells gnuplot that the canvas should not be reset *after* the plot, or indeed after the next several plots leading up to "unset multiplot". It also tells gnuplot there are a number of other things it should not allow while in multiplot mode (most of them pretty obvious - like not change the terminal type). > If I wanted to change the canvas size (for example, the resolution of a > bitmap plot, or the paper size), I would expect this to be done using "set > terminal <whatever> <canvas size>". I was using "canvas" to refer to the subarea within the physical page or window or piece of paper within which the plot lies. The size of the page or window or paper is a separate specification, and is unfortunately terminal-specific. For instance set term png size 600,480 set term dumb 79 49 Perhaps even more unfortunately, there is no such option for the PostScript terminal. That may be the real bug here, if there is one. Anyhow, "set size" is independent of this, and controls how much of that terminal size (or page size) can be written on by the next plot. Consider: set term png size 600,480 set size 0.5, 0.5 plot sin(x) set term png size 300,240 set size 1,1 plot sin(x) Both of these will produce a graph that occupies roughly 300x240 pixels, but the first one will be surrounded by a lot of empty space in a large window. The second one will be in a smaller window which it mostly fills. In the second plot of your example you told the postscript driver that it could only write to half of the total paper ("set size 1,0.5"), and so that's what it did. -- Ethan A Merritt Department of Biochemistry & Biomolecular Structure Center University of Washington, Seattle |
From: Lutz M. <ma...@uc...> - 2004-06-05 20:41:02
|
On Friday 04 June 2004 21:54, Ethan A Merritt wrote: > Consider: > > set term png size 600,480 > set size 0.5, 0.5 > plot sin(x) > > set term png size 300,240 > set size 1,1 > plot sin(x) > > Both of these will produce a graph that occupies roughly 300x240 > pixels, but the first one will be surrounded by a lot of empty space > in a large window. The second one will be in a smaller window which > it mostly fills. This is exactly the behavior I would expect: you define the size of the created image (i.e., the resolution) in the "set term" command, and the size of a graph relative to the total image size using "set size". > In the second plot of your example you told the postscript driver > that it could only write to half of the total paper ("set size 1,0.5"), > and so that's what it did. I wasn't aware that this is what the "set size" command does. I though that it tells gnuplot that "whatever graph you plot, do it in a way that it covers the whole width of the output medium, but only half its height". I didn't expect the "set size" command to change the size of the output medium itself, which I thought was always 10"x7" for the postscript terminal. Lutz |