I'm certainly missing something very obvious but how to change the basic colors Gnuplot uses (which can be seen via command test
)?
I want to define some colors and then to be able to use them as basic colors with linecolor 1
, etc.
Here's an example, which to my understanding should override colors -- and yet it doesn't:
set palette defined (0 '#A6CEE3',\
1 '#1F78B4',\
2 '#B2DF8A',\
3 '#33A02C',\
4 '#FB9A99',\
5 '#E31A1C',\
6 '#FDBF6F',\
7 '#FF7F00' )
set style arrow 1 \
nohead \
linecolor 1 \
linewidth 2
set style arrow 2 \
nohead \
linecolor 2 \
linewidth 4
set style line 3 \
linetype 1 \
linewidth 3 \
linecolor 3
set xrange [-10:10]
set yrange [-2:10]
set arrow from 1,-2 to 1,10 arrowstyle 1
set arrow from -10,3 to 10,3 arrowstyle 1
plot sin(x) with lines linestyle 3, \
5 with vectors arrowstyle 2
The colors are taken from the paired palette, while on the graph Gnuplot still uses the default colors (can be seen on the background, which is part of the test
command output).
It seems palettes are used to convert a continuous analogue value into a smooth colour choice. You only want to "index" into the palette at the defined points you specified, using discrete values of 0, 1 ... 7 to get to the colour.
It looks like you can do this if you use a colourspec of the form linecolor palette cb
index. You need to set the range of the "colourbar" first. Try
set cbrange [0:7]
set style arrow 1 \
nohead \
linecolor palette cb 1 \
linewidth 2
set style arrow 2 \
nohead \
linecolor palette cb 2 \
linewidth 4
set style line 3 \
linetype 1 \
linewidth 3 \
linecolor palette cb 3
Add unset colorbox
to not show the range of colours at the right-hand side.