Ive changed the font size of the Graph title and the x and y axis label to the double size. Now the title and axis labels are much bigger but they are cut of by half and reach into the graph itself.
Is there an option to set a margin for the title so they are plotted complete and without reaching into the graph?
// Im using gnuplot 4.6 patchlevel 0
The label position and the margins are calculated based on the overall terminal font size, which can be set with set terminal or set termoption font ',20'.
So if you increase the font size locally (only for the title and axes labels), the margins and the label positions are wrong.
You can set explicit margins like set lmargin 5, which reserves a left margin corresponding to 5 character widths, or even absolute margins with e.g. set lmargin at screen 0.1. For title and xlabel there is an offset option, which allows to adjust the label position relative to the default position.
set terminal pngcairo size 600,400 font ',10'
set output 'output.png'
set xlabel 'xlabel' font ',30' offset 0,-1
set bmargin 5
plot sin(x)
Related
I have the next plot of a KDE density plot of a dataset in file AAFPStable.dat which has 5 columns.
I only want to use the first for the plot.
set encoding iso_8859_1
set key right top font "Helvetica,17"
set ylabel "Density" font "Helvetica,18"
set xlabel "Minutes" font "Helvetica,18"
set xtics font "Helvetica,16"
set ytics font "Helvetica,16"
set title "Event 1" font "Helvetica, 18"
set size 1, 1.2
set terminal postscript eps enhanced
set grid
set key spacing 1.5
set key box linestyle 1 width 3
lfps = system("cat AAFPStable.dat | wc -l")
set output "event1-gnu.eps"
plot [0:150][] "AAFPStable.dat" using 1:(1) smooth kdensity bandwidth 2.5 lw 2 title "FPS"
The problem is that now the figure shows de KDE density plot but on the y-axis, it shows the number of occurrences. I would like to have the normalized density plot showing probability densities between 0 and 1. The command says that the second column should be 1/(count of points). The value of lfps is the number of rows of the file. I have tasted to change 1:(1) by 1:(1/lfps) but it does not work. I would not like to generate an intermediate file with the first column of AAFPS.dat and add a second with the value of 1/lfps.
How could I indicate gnuplot to plot the normalize KDE density plot?
Thank you for your help
Regards
It works with
plot [0:150][] "AAFPStable.dat" using 1:(1./lfps) smooth kdensity bandwidth 2.5 lw 2 title "FPS"
Thanks
How do I move the vertical grid lines so that they match the horizontal labels/xtics?
In the following image, the vertical grid lines don't line up with the xtics:
I tried setting the xtics offset before setting the grid, but that doesn't seem to work.Here's my current script:
#!/usr/bin/gnuplot -persist
set terminal png nocrop font small size 40000,800
set output 'decode3.png'
set style data linespoints
set title "Raw Audio Chunk"
set xlabel "Count"
set ylabel "Sample Value"
set xtics 16 offset 10
set ytics 10000
set grid
plot "decode3_Samsung_Exhibit.csv"
Thats the wrong way of thinking about this! The offset parameter only shifts the xtics labels (in your case by 10 character widths), but the xtics remain at their original positions. And the grid lines are drawn at the tic positions.
What you probably want is to shift the data a bit to the right. That is done by shifting the actual x-values to the right like
set xtics 16
set grid
plot "decode3_Samsung_Exhibit.csv" using ($1 + 10):2
That assumes, that your data file has two columns. The x-values are shifted by 10 (in units of the x-axis) to the right.
I am using multiplot to plot four graphs. My code is given below
set term postscript eps enhanced color
set pm3d map
set pm3d corners2color c1
set size square
set out 'defect2.eps'
unset colorbox
set colorbox horiz user origin 0.1,0.7 size 0.8,0.02
set cbrange [-1.6:0]
set xtics 25
set ytics 25
set lmargin at screen 0.1
set rmargin at screen 0.9
set multiplot layout 1,4
set xlabel "i" font "Times-italic,20"
set ylabel "j" font "Times-italic,20"
spl 'defect.dat' notitle
unset ylabel
spl 'defect_2.dat' notitle
spl 'defect_3.dat' notitle
spl 'defect_4.dat' notitle
unset multiplot
set out
This produces a following plot
However, individual plots in the picture are not properly placed. I cannot see ylabel for the first plot as it is hidden behind the screen whereas there are large blank gaps between those plots. Is there any way to reduce these gaps, increase size of these plots and show the labels properly?
Thanks in advance.
The Problem is your margin setting. The margin defines the size of the white stripe between the box containing the plot and the border of the window.
This means, tic and axis labels are printet on the Martin area! And your 10% of window width is not enough, so the labels are clipped.
So you can adjust the margins to shift all plots more to the left or adjust label font sites and offsets (Miguel's comment).
I want to plot two charts (reading the same data points) using multiplot. The purpose is to put the second (smaller) chart in the right of the first (bigger) chart.
The code is
set term post eps enhanced color blacktext size 4,4 solid "Times-Roman" 14
set output 'cla.ps'
set multiplot
# draw bottom and left lines
unset border
unset xtics
unset ytics
set border 3
# increasing the canvas size
set rmargin 50
set tmargin 2
# put the big chart, it will not use the whole space
set origin 0,0
set size 1.2,0.5
plot 'test.txt' u 1 with points lc rgb "black"
# put the small char in the right
set origin 0.6,0.2
set size 0.2,0.2
plot 'test.txt' u 1 with points lc rgb "black"
# always unset multiplot
unset multiplot
Problem is, the second chart is shown in a mirror fashion (horizontal flip). But I didn't such an option. How can I fix that?
That should give you a nice warning explaining that: warning: Terminal canvas area too small to hold plot. Check plot boundary and font sizes.
With set rmargin 50 you set the right margin to be 50 character widths. That applies also to the second plot unless you use e.g. set rmargin -1 to reset it to automatic calculation.
But I don't see any sense to set both the size and the rmargin. Setting the rmargin does not increase the canvas size, like you suggest in your comments.
Here is a working example:
set term post eps enhanced color blacktext size 4,2 solid "Times-Roman" 14
set output 'cla.ps'
set multiplot
# draw bottom and left lines
unset tics
set border 3
# put the big chart, it will not use the whole space
set origin 0,0
set size 0.8,1
plot x**2
# put the small char in the right
set origin 0.75,0.2
set size 0.25,0.3
plot x
# always unset multiplot
unset multiplot
That gives you the output (tested with 4.6.5):
I want to rotate the xtics by 45 degree. In another word the direction is /. Problem is the tics will appear inside the chart area, I want to put them outside of chart. See the figure:
You must adjust both the alignment (can be right, center or left) and the offset (x,y coordinates with respect to the default tics position) of the xtics.
Here is an example, which demonstrates the three different possiblities. The offset must be adjusted manually, in order to get it right:
set xrange [0.5:3.5]
set bmargin 5
set multiplot layout 1,3
set xtics ('first' 1, 'second' 2, 'third' 3) rotate by 45 right
set title 'right aligned'
plot x
set xtics center offset 0,-1
set title 'centered'
replot
set xtics left offset 0,-2
set title 'left aligned'
replot
unset multiplot
This gives (with 4.6.4):