Transparent background picture and the color of certain points - gnuplot

Basically I have a picture which is a collection of complicated shapes with its own axis and different colours and a data set of points which I can plot on top of it, that works fine, see minimized code example. I am using fortran to generate a gnuplot command file and run gnuplot.
plot "Random.png" binary filetype=png with rgbimage axis x2y2, "xydata1.dat" using 1:2 with points axis x1y1
My problems are that the picture makes it hard to see the points on top. Due to the shapes being a lot of different colours it is impossible to pick a colour for the points which is clearly visible on all shapes.
So could the picture be put in the background at say 50% transparency, without making it transparent in another program?
And is it possible to get the colour of the background on the locations of the points back so that the shape they are in can be determined automatically?

You can use the rgbalpha plotting style and given an explicit transparency value:
plot "Random.png" binary filetype=png using 1:2:3:(127) with rgbalpha axis x2y2\,
"xydata1.dat" using 1:2 with points axis x1y1
The transparency value must be between 0 (completely transparent) and 255 (fully opaque).

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

Default weighing criterion for gnuplot's 'lc palette'

I'm a novice in Gnuplot. Today I was plotting a simple txt file with two data columns, being the x and y coordinates of a cloud of points in the xy plane; I wanted to color them according to the position they occupied in the list, so I should have gone for something like:
plot "data.txt" u 1:2:0 lc palette
that produces what I want:
(desired plot)
By mistake, I omitted the "using" part of the command, so that I prompted:
plot "data.txt" lc palette
Now, the points still are plotted in the correct positions, so that gnuplot is automatically interpreting them as (x,y) coordinates... but the colors look like this:
(strangely colored plot)
I find this baffling since there's the possibility that I'm involuntarily highlighting some interesting feature of my data (which, by the way, consists of few iterations of a discrete recurrence for a set - the x=1.57 line you can see - of different initial conditions.
The question is: what criterion does 'lc palette' use to assign the parity I see to my points? What is its default behavior supposed to be in this case?
Thanks in advance!
EDIT: I don't know if it can be useful, but prompting 'show palette' I get:
palette is COLOR
rgb color mapping by rgbformulae are 7,5,15
figure is POSITIVE
all color formulae ARE NOT written into output postscript file
allocating ALL remaining color positions for discrete palette terminals
Color-Model: RGB
gamma is 1.5

Gnuplot: 3D plot scattered data with color

How can I plot (many) uncorrelated points from a data file in 3D with color corresponding to the value of one column? The color-value is non-integral.
======================================================================
details:
I have a large data file with three columns of the form
longitude latitude color
The data is scattered and uncorrelated, i.e. no underlying grid and no relationship between the points (except that every coordinate appears only once). color is an arbitrary scalar. I know the min and the max value of that, and would like to have linear scaling of the color in between. Which colormap is not clear atm, a first step would be to produce any meaningful output.
How can I plot dots on the longitude-latitude coordinates on the unit sphere (i.e. radius = 1) with the specified color?
No interpolation is wanted, not even a connection between the points. (I'm also happy for suggestions how to do that in an easy way, but it's actually not important)
This is how far I've gone, but the coloring is missing:
set mapping spherical
splot 'the_file.data' u 1:2:(1)
Thanks a bunch!
You can use linecolor palette, which allows you to specify an additional column which is used to select the respective color from the current palette:
set mapping spherical
splot 'the_file.data' using 1:2:(1):3 linecolor palette

gnuplot print legend directly next to individual graphs

I want to project a 3D plot into a 2D plot. Assuming f(x,y) describes my 3D plot, I want to treat y as a parameter and simultaneously plot f(x,0), f(x,2), f(x,4), etc. in one 2D plot. Instead of going for different line/point styles and colors with a legend in a corner, I'd like to make each plot in the same style and place a label next to each individual line.
Is this even possible in gnuplot or would I have to fall back on something more complex?
I had a similar question recently. There is an option in the development version of gnuplot (4.7.0) that does this. You can change the position of line titles to be at the end/beginning of the line itself. If your plot looks like I imagine (sort of a contour plot) this may be what you want:
plot f(x,y) title 'f(x,y)' at end
Otherwise you may have to specify the labels and their positions manually:
help set label
for more info.

How to make an horizontal box-and-whiskers plot in gnuplot

How do you make an horizontal box-and-whiskers plot in gnuplot? Similarly to this one:
Gnuplot can easily be used to produce vertical box-and-whiskers plots with the 'candlesticks' and 'whiskerbars' keywords, but I have not managed to find any example of an horizontal candlesticks/box-and-whiskers horizontal plot produced via gnuplot online.
Example of a vertical plot produced by gnuplot:
example of a vertical box-and-whiskers plot http://www.cise.ufl.edu/~dts/cop3530/proj02/candlesticks.6.png
Gnuplot generally doesn't switch directions well... for example you can't plot rows instead of columns, and it's hard to make histograms (or any other kind of plot) go horizontal instead of vertical.
People have made horizontal histograms, however, and you might be able to modify the code found at this site.

Resources