gnuplot: subtitle with smaller fontsize - gnuplot

Does somebody know how you can insert a subtitle with a smaller fontsize in gnuplot?
Currently, the way I create a subtitle is by using \n in the title. Additionally, I would like the subtitle to have a smaller fontsize.
Thanks in advance.

This works for the postscript terminal at least (for some reason x11 didn't want to scale my font. Perhaps it is a bug...):
set term <whatever> enhanced
set output "<whatever.ext>"
set title "Big Title\n{/*0.5 subtitle}"
The {/*0.5} scales the fontsize to be half of the current active fontsize. You can also specify fontsizes explicitly:
set title "{/=20 Big} Medium {/=5 Small}"
Or you can change the font for a region of text:
set title "{/Helvetica foo} {/Symbol G}"
These forms can be combined to change the font and size in a particular region of text as well:
set title "This is a big gamma {/Symbol=20 G}"
For more information about enhanced text, see help enhanced.

You can use label. You have to experiment a bit with its proper placement by at:
set title "Big Title"
set label "Subtitle" at screen 0.5, 0.9 font "Arial,8"
plot sin(x)

Related

math latex font in postscript terminal

I know the epslatex terminal can be used to have fonts in latex style.
But how can I emulate math latex fonts in the postscript terminal?
set term postscript size 5,4
set out "test.ps"
pl [][-1.1:1.1] sin(x) t "sin {/Italics x}"
set out
In math latex
it would look like:
So it seems I want a serif font.
IMHO this is far more trouble than it is worth. But if you really want to you can download Adobe Type 1 versions of the standard TeX fonts for use in PostScript, specifically for use by the gnuplot postscript terminal. Here is a demo.
#
# Demonstrate use of TeX Computer Modern fonts in gnuplot PostScript terminal
# This demo requires Adobe Type 1 fonts that may not be installed on your system.
# If necessary you can download them from
# http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/pfb/cmr10.pfb
# http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/pfb/cmmi10.pfb
# http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/patched-pfb/cmsy10.pfb
#
set term post eps color fontfile 'cmr10.pfb' fontfile 'cmmi10.pfb' fontfile 'cmsy10.pfb'
set output 'cmfonts.eps'
set title "Use of TeX Computer Modern fonts in gnuplot PostScript terminal"
set label 1 'Times-Roman: {/Times-Roman abcdefghABCDEFGH}'
set label 2 'cmr10: {/cmr10 abcdefghABCDEFGH}'
set label 3 'cmmi10: {/cmmi10 abcdefghABCDEFGH} {/cmmi10 \013\014\015\016\042}'
set label 4 'cmsy10: {/cmmi10 abcdefghABCDEFGH} {/cmsy10 \013\014\015\016\042}'
set label 1 at graph 0.05,0.6 left
set label 2 at graph 0.05,0.5 left
set label 3 at graph 0.05,0.4 left
set label 4 at graph 0.05,0.3 left
set xlabel "{/cmmi10 \013}"
plot [0:2*pi] sin(x) title "{/cmr10 sin({/cmmi10 \013})}"
Serif (Times) in combination with Oblique (Italic) also emulates a bit the look of latex math.
set term postscript size 5,4
set out "test.ps"
set label 1 'Serif: {/Serif abcdefghABCDEFGH}' at graph 0.05,0.5 left
set label 2 'Serif Oblique: {/SerifOblique abcdefghABCDEFGH}' at graph 0.05,0.4 left
set label 3 'Symbol: {/Symbol abcdefgh}' at graph 0.05,0.3 left
set label 4 'Symbol-Oblique: {/Symbol-Oblique abcdefgh}' at graph 0.05,0.2 left
pl [0:2*pi] sin(x) t "{/Serif sin} {/SerifItalics x}"
set out
This does not fully look as I asked for, but may look even better in documents using Times anyway.
The credit for Oblique goes to http://www.gnuplotting.org/postscript-terminal-with-italic-symbols/.

How to place labels on top of the margin?

I am using gnuplot with epslatex terminal. I want to know how to put the
label on top of a margin, so that the part of margin under the label is invisible. In the figure I attached, the part of margin under the label
is still visible.
In principle you should be able to tell gnuplot to put your text labels into a box by using the set label ... front boxed, and the specify that the box should be opaque and white using something like set style textbox opaque noborder fillcolor rgb "white". However, this is not supported by all terminals, and epslatex seems to be one of those where this doesn't work.
However, in epslatex you can simply use latex commands to create a white background box around your label text:
set term epslatex standalone
set outp "test.tex"
set label "\\colorbox{white}{This is a label}" at 6.,0.5 front
plot sin(x)
set output
gives

force graphs legend/key to a specific size

i want to generate some plots from my data that i want to include in some documentation.
I put the box outside the graph area.
the problem is that for different plots the box has different sizes so also the graph area changes its size. this looks very messy in the document becasue the plots are vertical aligned.
I am searching for a way to fix the size of the box to some width that is appropriate for all plots but i could not found a way to do so.
the set key command has a width parameter but it seems not to do that one would expect from such a parameter.
It would be grat if someone could help.
thanks
vlad
I hope I got the correct impression of what you want. Consider the following example
reset
set multiplot layout 2,1
set rmargin screen 0.7
set key reverse Left left top at screen 0.72, graph 1
plot sin(x), cos(x) t 'long title'
plot sin(x), cos(x) t 'very long title'
unset multiplot
Which gives you:
Both the samples and the text do not move. You must only set an appropriate rmargin. left and top is the key box alignment regarding the position specified with at ..., although these settings are default, I explicitely included them for clarity. Left is the alignment of the entry text.

How increase the size of the legend in Gnulot

Can someone please direct me as how to increase the size of a legend in Gnuplot.
I wish to place the legend outside with:
set key outside top
But now I want the legend to appear larger in size. How can this be done?
The font specification can follow the setting of key, from help key:
{font "<face>,<size>"}
You do not need to specify the face if you only want to change the size, e.g. to set font size to 16 do this:
echo 'set key outside top font ",16"; plot sin(x) w l' | gnuplot --persist
Which fonts are available depends on the terminal setting, e.g. if your terminal is wxt, you can find out more by running help wxt, etc.

How to make plots larger in GnuPlot

I am generating mapped 3D plots using the following config file (XRANGE and YRANGE are set later)
#!/usr/bin/gnuplot
reset
set term postscript eps enhanced
set size square
set xlabel "X position"
set ylabel "Y position"
#Have a gradient of colors from blue (low) to red (high)
set pm3d map
set palette rgbformulae 22,13,-31
set xrange [0 : XRANGE]
set yrange [0 : YRANGE]
set style line 1 lw 1
unset key
set dgrid3d 45,45
set hidden3d
splot "data.data" u 1:2:3
The resulting image looks something like this
Note: I have converted to jpg so the quality is lower, and I have placed a border around the image.
A great deal of space is wasted above and below. This is not a problem until I embed the image into a LaTex document, at which point it will look like so (again, pdf document converted to jpg image)
The image on the right is also created with GnuPlot, but it is slightly larger (as is evident by looking at the border I have drawn around the top two images). The reason for this is because GnuPlot pads the 3D plot with top and bottom white space. How can I remove this without having to manually edit all 50+ plots I have?
There are two solutions to this, one is unreliable, the other is a hack.
Using GnuPlot, the margin settings can be used to specify distances from the appropriate margins. For example, setting lmargin 0 and bmargin 0 essentially pushes the axes off the page. Similar values can be assigned to the tmargin and rmargin to stretch the graph. Although this worked for 2D graphs, it did not work for 3D graphs (I suspect this has to do with the fact that I set the graph to be a square).
When graphs are set to be of square size, Gnuplot still calculates for the entire screen. The eps file can be manipulated directly to change this by looking for a line like so %%BoundingBox: 50 50 410 302 and changing 410 to something smaller. Alternatively, and this is what I did, you can run eps2eps in.eps out.eps and it will crop it for you. Just make sure in.eps is not the same file as out.eps or it won't work.
I also crop the Bounding Box afterwards, since I hate playing around with margins in gnuplot. I realized that somehow, eps2eps indeed does adjust the bounding box, but it also transforms text (labels etc) into pixel-graphic?!
I usually use "epstool" which conserves text as text when croping the bb, the command I use is:
epstool --copy --bbox in.eps out.eps
Use the <scale> argument in set view, this will magnify the plot without changing text size or title position.
In your case, because you use the map view, you need:
set view 180,0,1.5
where 180,0 is equivalent to map view and 1.5 is the scaling factor.

Resources