How to reduce the gap between plot title text and the legend in gnuplot? - gnuplot

How can I reduce the gap between plot title text and the legend in gnuplot ?For example in the following plot how do I reduce the gap between ABC* and circle symbol?I am using ubuntu version 18.04 and gnuplot version 5.2.

There are a lot of customization options for the legend. One way to do it is to reduce the total width ("sample length") allocated for the symbol.
set key samplen 0.5 # reduce sample length to half the default

Related

How to reduce or have no spaces between bars in the plot along with the reduction of width of the bar(size of each bar probably all are of same size)

I have plotted a simple bar graph having 3 bars and what should i do for having no spaces or reduce space between the bars in plot and also reduce the width at atime
i have tried bargap=0 for no space and it has reflected but if i use width=0 along with it ,at a time both are not reflected .My plot orientation is vertical

gnuplot boxes with labels needed

Im trying to draw a simple gnuplot bar chart. With labels on top of each bar.
this is my test.out
279 2 10149
286 1 699999
295 3 14098
and this is my command:
echo "set terminal dumb size 70,30; plot 'test.out' using 3:xtic(1) with boxes" | gnuplot
It draws a boxes. I want also labels on top of each.
Please help )
You must plot the data again with labels.
To get the correct x-positions, you must know that in your plot command plot 'test.out' using 3:xtic(1) with boxes the x-position is implicitely taken as the row number.
Also, when plotting with labels it is best to explicitely format the label string. Using only a column may or may not work and can give quite surprising results, depending on your data.
So, to be short:
plot 'test.out' using 0:3:xtic(1) with boxes,\
'' using 0:3:(strcol(3)) with labels offset 0,1
This plots the string content of column 3 as label at position (rownumber, value from column 3), shifted by 1 character height in y-direction.

Plotting heatmaps in gnuplot

So, here I am trying to plot heatmaps in gnuplot. I have a matrix-formatted text file (with row and column headers), and the command I am using to plot it is
plot "file.txt" matrix rowheaders columnheaders using 1:2:3 w image notitle
The output is this graph:
Obviously, the X and Y labels are useless like this. I believe the problem here is that gnuplot is extracting all labels from the file and plotting them. How would I go about reducing the amount of clutter in here, e.g. plotting every 10th label or so?
Thanks in advance.
Or just make the picture resolution bigger... for instance like 1920,1080 or bigger... like this:
set term pngcairo size 1920,1080
or make the tics numbers like 1000000 smaller and make a label to show that the numbers written on the tics are 1000000 bigger... or both:)
Sorry for my english...

Drawing box plot with gnuplot 4.6

In the official document in page 44 it says, to draw a boxplot
# Place a boxplot at x coordinate 1.0 representing the y values in column 5
plot 'data' using (1.0):5
I cannot get it work, when I do above gnuplot only draws points, not a box. Anybody knows how to do it? In the guide, the example shows a box plot (page 44 the figure on the right)
I am using gnuplot 4.6 patch level 4. I am not getting any errors, but the box is just not there.
When I use the demo script
plot 'silver.dat' using (1):2, '' using (2):(5*$3)
it works, what does the second part after the comma mean? ( '' using (2):(5*$3) )
I was specifying box widths, but finally found that this should be added at least
set style data boxplot
optionally, you can add
set style fill solid 0.25 border -1
set style boxplot outliers pointtype 7

gnuplot gives me strange plot look

I could not describe how the plot looks like so I just use "strange" as I have no idea why gnuplot gives me such a plot. Here is the thing I am trying to do.
I have a data file with two columns, the first column is the file name and the second is the size of each file. Each column is more than 2 million rows. I just want to plot the distribution of file sizes. Here is my code
set terminal postscript landscape enhanced mono dashed lw 2 "Times" 18
outputfile = "sizedist.ps"
set output outputfile
binwidth = 0.05
bin(x,width)=width*floor(x/width)
plot [0:3.5][]'sizedist.out' using (bin(log10($2/1024),binwidth)):(1.0) smooth freq with boxes t "Binsize=0.05 dex"
set terminal x11
Ideally, it should be a single Gaussian-like bar plot, but it has many other plots over-layed (see my attachment). Any expert on gnuplot knows why this happened?
This happens if some of your data in the frequency plot does not have well defined values (such as NaN, inf etc.).
Since you are using a logarithmic function in the plot, you have to be careful with data that has values <=0. I guess you have files with size=0. In this cases log10 just gives you NaN and this messes up the counting procedure of the frequency plot.
Include a condition to your plot to fix this. For example:
plot [0:3.5][]'sizedist.out' using ($2>0?bin(log10($2/1024),binwidth):0):(1.0) smooth freq with boxes t "Binsize=0.05 dex"

Resources