Gnuplot - how can I get a figure with no point on it ? (I want to have only the axes, the title and the x- and y- labels) - gnuplot

I have to create a video presenting the evolution of some quantities as functions of time. I am creating images with gnuplot and I assemble them to make a movie. I am getting trouble generating the two first images: the first image is supposed to have no point on it (it is supposed to show only the title of the graph, the x and y axes and the labels of the axes) and the second one is supposed to have one single point on it.
Is it possible to create a graph containing no data on it with gnuplot?
Is it possible to create a graph containing one single point with gnuplot using an input file? The input file contains:
0 15
Thank you in advance for your answers,
Julien

To plot an empty graph, just plot a completely undefined function like
plot NaN
The main issue here is, that the autoscaling fails since there are no valid points. You must give a fixed xrange and yrange to get a plot:
set xrange [0:1]
set yrange [0:1]
plot NaN notitle
Plotting a single point works fine using
plot 'file.dat' using 1:2 with points
You'll get warnings saying Warning: empty x range [0:0], adjusting to [-1:1] and Warning: empty y range [15:15], adjusting to [14.85:15.15], but you get a plot. To remove the warnings, you must again provide a fixed xrange and yrange.

Related

Draw boundary on colormap in Gnuplot using second data file

I have an ASCII data file (density.dat) in the format (x y D), where D represents a density-value at the point (x,y), from which I create a colormap:
set pm3d interpolate 2,2 corners2color mean
set view map
splot data_file u (1e9*$1):(1e9*$2):3 with pm3d
I have a second data file (potential.dat) with the same format (x y P), where P represents a potential value which can only have one of two values zero or 1.0 (say). I would like to indicate the boundary between the (three) regions (a straight line with slight perturbations) where the potential is zero and the regions where it is non-zero and overlay it on the first colormap of the density.
I though the approach where I plot the contours from one file on the plot of another file (similar to here), could work but the exported data using the 'set table filename' cannot be used for 'plot filename with image' it seems.
I would greatly appreciate ideas (or solutions..) to tackle this problem.
======== EDIT ==========
Working solution for me:
set contour base
set cntrparam level discrete 1.0
splot density_file u 1:2:3 with pm3d nocontour,\
potential_file u 1:2:3 w l nosurface
In the link you give, with image is used to plot the colour map, not the isolines, these are plotted with lines. I am not sure why you need to go through a table at all, it seems that you can handle everything with splot commands, unless you want to make fancy customisations or have strong constraints with margin control. See the discussion at the top of the post
http://gnuplot-tricks.blogspot.co.uk/2009/07/maps-contour-plots-with-labels.html
You will need to give more details in your post if you want a more precise answer.

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...

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"

Gnuplot fat lines overlap with axis

Heyho!
I need to make some lines with gnuplot. However due to the small size of the plots, I want to make those lines fat. However they overlap now with the axis. and into the normal picture. How can I cut those lines of so they dont do it?
Thanks!
If you are plotting data, you can adjust the overall x and y ranges so that the lines don't overlap with the borders:
set xrange [xmin:xmax]
set yrange [ymin:ymax]
If you are plotting functions, you can also cut off lines by adjusting the range when you plot:
plot [xmin:xmax][ymin:ymax] ...
This is a little more tricky because the function will automatically go to the edge of the plot anyway. If this is the case, you can specify a larger range for a blank line:
plot [-2:2][-2:2] NaN notitle, [-1:1] x**2 title 'x^2'

custom y scale in plot for

I have a data file, looking like
550 1.436e+00 7.857e-01 5.906e-01 4.994e-01 4.574e-01 4.368e-01 4.260e-01 4.273e-01 4.296e-01 4.406e-01 4.507e-01 4.639e-01 4.821e-01 5.008e-01 5.156e-01 5.378e-01 5.589e-01 5.768e-01 5.970e-01 6.196e-01 6.422e-01 6.642e-01
The first column is for x-axis, the rest ones are for the y-axis, 22 curves totally.
I want to plot the data so that y tics represent cube roots of the values. Actually, I want my cubic curves to become linear, to show, that they're cubic in the normal coordinates (and it is fixed by my task to use these coordinates).
I tried to use the following command:
plot for [i=2:23] datafile using 1:(i ** .333) smooth cspline
It expects column number in place of i.
I know, the following is correct:
plot datafile using 1:($2 ** .333) smooth cspline
giving me the desired plot for my first line. But how do I modify this for plot for?
If you want the column number in place of i, you should use column(i) in the using specification.
plot for [i=2:23] datafile using 1:(column(i) ** .333) smooth cspline

Resources