Is there a easy way to get points with black outline in gnuplot? - gnuplot

Is there a easy way to get points with black outline in gnuplot? I'm using standard color filled point types, for example:
set style line 3 lc rgb '#4682B4' pt 9 ps 0.65
but I need to make sure that the plot will be easily readable in black & white version too. Black outlines would help, how can I add them?

The simplest "quick and dirty" solution that comes to mind is to plot the data set twice, once with the full symbol style and then with an empty symbol style. For instance:
plot "temp" pt 9 ps 2, "temp" pt 8 ps 2 lc 0 lw 2

Related

How to show a grid with two filled plots

I am plotting to datasets with 'fillsteps' one below another and I want the plot two show only the area that is a difference between the two
plot [0:1][0:1] x with fillsteps above fill solid not,x**2 with fillsteps above fill solid lc rgb 'black' not
But the grid obviously gets blocked in this case:
Is there any way to create something like a cross-section between the two areas, show the grid and get rid of those nasty artifacts that are seen below?
Ok, basically you want to fill the area between two curves (either lines or steps) and have a grid on top. The set grid front you found yourself, but let me make another suggestion.
For the first case (lines), i.e. a fill between lines, you can simply use 3 columns (check help filledcurves) and then the area will be filled between the curves:
plot '+' u 1:(f1(x)):(f2(x)) w filledcurves
For the second case (steps), I don't see (yet) such an option with filledsteps. Actually, from your option above I assume you are using gnuplot5.5.
In general, I wouldn't call it a "clean" solution if you plot something and partly have to cover it with something else with background color. What if you want a transparent background? A transparent color which covers something colored has not yet been invented ;-), there is no such "invisible" color. For another example check this.
Furthermore, with fillsteps I can also observe the artifacts of vertical gap lines which you see in your graph, but I don't have a good solution to avoid them.
Hence, my suggestion is to plot only there where you need something to plot. Actually, you can mimic the fillsteps behaviour. It's not obvious how to do it, but not too difficult. While you plot line by line, you remember the previous x-value and function values of f1(x0) and f2(x0) in x0, y0 and y2, respectively. You plot with the plotting style boxxyerror (check help boxxyerror) using x:y:xlow:xhigh:ylow:yhigh.
Script: (works with at least gnuplot>=5.0.0)
### plotting style filledcurves and mimic fillsteps "between"
reset session
f1(x) = x
f2(x) = x**2
set xrange[0:1]
set yrange[0:1]
set key noautotitle
set grid x,y front lw 1.3
set style fill solid 1.0 border
set samples 50
set multiplot layout 2,1
plot '+' u 1:(f1(x)):(f2(x)) w filledcurves
plot x1=y1=y3=NaN '+' u (x0=x1,x1=$1):(y0=y1,y1=f1($1),y2=y3,y3=f2($1)):(x0):(x1):\
(y0):(y2) w boxxy
unset multiplot
### end of script
Result: (download the PNG image and check that the background is transparent).
set grid front
works in this case

Thickness of pattern fill in Gnuplot

I am using Gnuplot and I wish to fill the area between two curves with transparent hatched pattern.
I define fill style with:
set style fill transparent pattern 1
and I plot it as:
plot "Data..." using 4:1:2 with filledcurves lc rgb 'black'
However, the resulting hatched pattern has extremely thick lines. I want to adjust thickness of pattern lines, density of lines etc.
I cannot believe I could not find anyone asking the same thing?

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

How to change dot size in gnuplot

How to change point size and shape and color in gnuplot.
plot "./points.dat" using 1:2 title with dots
I am using above command to plot graph ,but it shows very small size points.
I tried to use command
set pointsize 20
but still point size is same.
Use the pointtype and pointsize options, e.g.
plot "./points.dat" using 1:2 pt 7 ps 10
where pt 7 gives you a filled circle and ps 10 is the size.
See: Plotting data.
The pointsize command scales the size of points, but does not affect the size of dots.
In other words, plot ... with points ps 2 will generate points of twice the normal size, but for plot ... with dots ps 2 the "ps 2" part is ignored.
You could use circular points (pt 7), which look just like dots.
plot "./points.dat" using 1:2 title with dt 2 lw 4

How to add custom label to Gnuplot graph legend?

In a graph I'm making with gnuplot I draw some grey lines (set arrow command), which represent the physical boundaries of my experiment (i.e., walls)
I would like to know how I can add this information on the legend of the graph, so it says "Walls" and have a grey line next to it.
I thought about creating a new series that contained this information, but I was wondering if it's possible to explicitly add it.
You can't add information directly to the legend. You can, however, either draw the legend explicitly, or plot a line which will not appear within the range of the plot, e.g.
plot [][0:1] 2 lc rgb 'gray' t 'Walls'
Or, if your x and y limits are already set:
...
[set x and y limits here]
...
plot 1e20 lc rgb 'gray' t 'Walls'
Just wanted to note: since plotting a single line tended to mess up a graph of mine, a better solution for me was to plot a single point; but as found in Plotting single points « Gnuplotting, that is kinda difficult (especially if insertion at arbitrary plot legend/key position is needed) - unless redirection is used... This is what worked for me:
plot "filename" using 1:8 \
,\
... # more plot lines here
,\
"<echo '-1 -1'" lc rgb 'white' with points title '---' \
,\
... # more plot lines here
One simple way is to make the name of the data file the legend which you want and then plot that data file.

Resources