Gnuplot intensity plot with grayscale - gnuplot

I am making an intensity plot with gnuplot using the following commands.
set palette defined
plot 'specttest.csv' u 1:2:3 with points linetype palette
Is it possible to make the same plot with a grayscale palette, ranging from white to black or black to white with varying gray levels?

Gnuplot offers many ways to specify a palette. For a gray palette, the simplest command is
set palette gray
To have the palette from white to black, use
set palette gray negative
I would recommend to use these commands, since then you can also use gamma to add gamma correction to the palette. With test palette you can see how the actual palette looks like:
set palette gray positive gamma 1.5
test palette
Other possibilities would be
set palette defined (0 'black', 1 'white')
or with 3 being the function x (see show palette rgbformulae):
set palette rgbformulae 3,3,3
or
set palette function gray, gray, gray

Related

Red color palette for gnuplot

I am looking for a palette in gnuplot for red color from very-light-red to deep-red. I found a script for black here http://gnuplot.sourceforge.net/demo_5.3/pm3dcolors.16.gnu
I tried by changing set palette functions red, red, red in the above script, but it is not working.
By "legend" do you really mean "palette"? The legend is the list of plot titles and samples; entries there will normally appear in whatever color the corresponding plot used. The palette is the color gradient used for pm3d plots. To define a gradient from white to deep red:
set palette defined (0 "white", 1 "dark-red")
test palette
If you want more precise control over how light/dark the two extremes are you can provide instead hexadecimal descriptions of the RGB components. E.g. the above command is equivalent to
set palette defined (0 "0xffffff", 1 "0x8b0000")

How to mange colors for contour map?

I want to plot contour maps using Gnuplot.
I tried using the following command,
set palette rgbformulae 33,13,10
splot filename u 1:2:3
This is the image file I got using those commands.
But I want to give a white color scheme when the third column has a maximum value. How to do this?
There many, many options for palette choice. Without going into all of them, I suggest you try set palette cubehelix
That provides a color range from dark to white. Here is the output from
set palette cubehelix
test palette

How do I use a data parameter to set the colour of gnuplot points?

I'm creating a GIF of the movement of random particles and I want to plot the particles as points of a certain colour that relates to the velocity of the particle at a given time. Using gnuplot 4.6.6, how do I make the colour of a point a function of a data value? If possible, I'd like the colours to come from the palette 'rgbformula 21,22,23' and not just from the standard line colours set.
Thanks
You can use the lc palette flag:
set palette rgbformulae 21,22,23
plot 'particles.dat' using 1:2:3 lc palette
type ? linecolor or ? palette for more info.
You can pass a third column to the plot command and linecolor palette. Then, the palette colors are used to encode the value of the third column and the colorbox showing the palette is drawn:
set palette rgbformula 21,22,23
plot "data" using 1:2:3 with points linecolor palette

Change color of dgrid3d surface in Gnuplot

Is there a way to change the color of the lines of the surface when using dgrid3d? It seem simple enough but everything I've looked at only speaks of coloring the whole surface using pm3d. I have multiple surfaces on one plot and would like to be able to specify the color of each. For example, one would be red, another would be blue, another would be black, another would be green.
If you have your data available in a file Data.dat then give this a try:
set dgrid3d 10,10
set style data lines
set pm3d
splot "Data.dat" pal
The dgrid3d tells gnuplot how many entries there are in the x- and
y-direction (those are the two comma separated parameters)
The style data lines lets gnuplot plot the result with lines
instead of points
The pm3d fills the surface with a color (if you leave this away you
will just see the lines)
pal makes the lines appear in the color of the specified value
There are much more options you can set, but i find those the most relevant.
Seems like.
set dgrid3d
splot "file.dat" with lines linecolor 4
Where 4 is color you need.
For multiple surfaces you can try
set dgrid3d splines
set table "surface1.dat"
splot "file1.dat"
unset table
unset dgrid3d
for every surface you need.
And after all surface description
splot "surface1.dat" with lines linecolor 4, splot "surface2.dat" with lines linecolor 7 ...

GNUPLOT: How to set reverse HOT color palette

Here is the example in http://gnuplot.sourceforge.net/demo/pm3dcolors.html
set palette rgb 21,22,23; set title "hot (black-red-yellow-white)";
The above code set the hot palette. However I want a reversed hot palette, say:
white-yellow-red-black.
Small least value map to white and largest value map to black.
Miguel's answer is correct. Rather than making the individual numbers negative, the command set palette negative also does the trick:
set pm3d map
set palette negative rgb 21,22,23
splot x
would produce what you wanted. You can split the command up too:
set palette rgb 21,22,23
set palette negative
is equivalent. You can use set palette positive to undo this modification, or set palette to restore all the defaults (including the colours). Try help set palette for the full list of things you can do.
Use negative numbers to invert the palette:
set pm3d map
set palette rgb 21,22,23
splot x
gives you
whereas
set pm3d map
set palette rgb -21,-22,-23
splot x
gives you

Resources