Modifying the margin alignment in gnuplot in multiplot mode - gnuplot

I have created two plots in multiplot mode using epslatex as output terminal. The y axis labeling is different for both the plots.The first plot's y axis ranges from [0:45] and the second plot's y-axis ranges from [-5e-008 to 4e-007]. Due to the different widths of the y-axis labels, the width of the second plot is less than that of the first plot. I have tried the available scaling options but they do not work. Is it possible to edit the plot so that I can have the same width for both the plots irrespective of the y-axis range?

The problem you're experiencing can be reproduced by doing something like so:
set multiplot layout 2,1
plot sin(x)
plot 100000*sin(x)
The left margins are clearly not aligned. To fix this, you can try an explicit definition of where the margins lie:
set multiplot layout 2,1
set lmargin at screen 0.15
plot sin(x)
plot 100000*sin(x)
If your images are side by side, you can adjust the margins taking the appropriate offset into account:
set multiplot layout 1,2
set lmargin at screen 0.15
plot sin(x)
set lmargin at screen 0.5+0.15
plot 100000*sin(x)

Related

gnuplot multiplot - layout and scale

Multiplot scale
I don't really understand the idea behind the scale option in the multiplot command of gnuplot.
set multiplot layout 2,2 scale x,y
There can be only one pair of values for the whole multiplot - what is it possibly used for? Is it really just for scaling all the graphs in the multiplot? What for?
It would make sense to me, if you could assign scale factors the the individual layout parts, in that I would say: first column takes 70% of the width, second column takes 30% etc but here?
I'd appreciate any explanation! Plus, is there a built-in function to generate multiplots using the "layout" option in the described manner?
Multiplot Layout
I want a multiplot layout consisting of a 4rows,2columns grid. Both columns should fill 45% of the space each, leaving a 10% white gap at the right which will be used for a label set right next to the second column via set label at graph 1,0.5 "text". (Actually, this means a 45% / 55% ratio of the two columns.)
This works with this MWE
set multiplot
mystring = "This is\na multiline\nlabel"
width = 0.45
height = 0.25
#1 1
set origin 0,1-height
set size width,height #remains the same
plot sin(x)
#1 2
set origin width,1-height
set label at graph 1,0.5 offset 2,1 mystring
plot cos(x)
unset label
#2 1
set origin 0,1-2*height
plot sin(x*2)
#2 2
set origin width,1-2*height
mystring = "This "This is\na different\nlabel"
set label at graph 1,0.5 offset 2,1 mystring
plot cos(x)
unset label
#etc...
unset multiplot
However, I want to put some labels (no title etc) above the first row. If I make space via set tmargin <val> for the first row, then the plots get squished, not shifted. Is there a way to somehow "add whitespace" around the plots, the top in particular? Or would I need to make the height variable a tad smaller and adjust accordingly?
Plus, I made no size settings, as you see, but used proportionals in the range of [0,1]. When using the epslatex terminal, I'll provide overall size information. Can I expect the ratios to preserve?

How do you increase the resolution of a contour plot in gnuplot?

I am using an analytical 2D function to make a contour plot. However, I do not get a smooth contour. (For example it should have been a circle but I get a oval shape.)
Here is the code snippet I am using:
splot f(x,y) t ''
set dgrid3d; set view 0,0
set cntrparam levels 10
set contour base
set nosurface
unset ztics
unset zlabel
set border 15
replot
Sounds like a matter of scale of the axes.
You can change the ranges of the axes using the xrange/yrange, etc
See, for example http://gnuplot.sourceforge.net/docs_4.2/node294.html

One big and two small plots in multiplot gnuplot

I am trying to plot three different plots on the same canvas using the multiplot mode of gnuplot (version 5.0.1)
I want an arrangement of these plots in a particular way: final plot should show 2 rows with plot A in the upper row while plots B and C should appear in the lower row side-by-side as if for a lower row we had something like:
"set multiplot layout 1,2"
How can this be achieved?
Thanks in advance
you need to do the multiplot with the most "refined" grid, in this case 2x2 and then specify the size of each plot.
set multiplot layout 2,2
set size 1,0.5 # the first one has to be larger
plot sin(1*x)
set multiplot next # we want to skip the second (upright position)
set size 0.5,0.5 # the second and third have to be 0.5x0.5
plot sin(2*x)
plot sin(3*5)
unset multiplot
or as suggested here https://stackoverflow.com/a/15906085/2743307 it might be simpler to do it upwards (6 lines instead of 8!) but you have to specify the plots in opposite order:
set multiplot layout 2,2 upwards
plot sin(3*x)
plot sin(2*x)
set size 1,0.5
plot sin(1*x)
unset multiplot

Can Gnuplot put Two y-axis on the left hand side of a plot?

I'm trying to create a plot which has two independent y-axes on the left hand side, i.e. sharing the same x-axis. Is this possible in Gnuplot? I'm aware that it can be done with python for example.
You can just do the plot on gnuplot's standard x1y1 and x1y2 axes, and then add the extra axis with multiplot.
This example here is not perfect, but should give you an idea how to do it. As Christoph said, it's a bit fiddly:
set multiplot
set lmargin at scr 0.2
set bmargin at scr 0.1 # fix bottom margin
set y2range [0:20]
plot x, 2*x axes x1y2 # this is your actual plot
set lmargin at scr 0.1
set yrange [0:20] # set yrange to the same as y2 in the first plot
set border 2 # switch off all borders except the left
unset xtics # switch off the stray xtics
plot -1000 notitle # plot something outside of the y(2)range
unset multi

Displace z-axis with gnuplot

Is it possible to displace the z-axis to the middle of the x-axis with gnuplot?
I've found a great gnuplot script here which nearly fits my needs perfectly, except that the z-axis should be going up at the middle of the x-axis.
by default gnuplot draws a border and places the labels on this border.
Draw only a border at the bottom, i.e around (x,y)-Plane :
set border 1+2+3+4
or disable it completely:
set border 0
draw a zaxis through the x,y-origin, and place the ztics on the same:
set zzeroaxis lt -1
set ztics axis
same for x and y, if you like.

Resources