Gnuplot default line color rgb values

Viewed 1975

I'm using gnuplot 5.2 and would like to get the rgb values associated with the default line colors. Using the command test I get a nice summary of available options and parameters but the default colors are just labelled by 1, 2, 3, .... and the rgb values are not shown. The command show colors is useful too, but that only shows the names of the colors and the rgb values, but not the labels 1, 2, 3, ... so I don't know which is which.

My goal is to use the default line colors and plot lines with transparency. From other questions here I learned that this is possible with version 5.2 by the color specificifaction lc rgb #aarrggbb but for this I need to know the rgb values.

And there doesn't seem to be a straightforward text configuration file for gnuplot containing the default line colors (I'm on fedora), rpm -ql gnuplot does not show any such config file, so I'm kinda lost.

2 Answers

Simple answer:

gnuplot> show linetype

        linetype 1,  linecolor rgb "dark-violet"  linewidth 1.000 dashtype solid pointtype 1 pointsize default
        linetype 2,  linecolor rgb "#009e73"  linewidth 1.000 dashtype solid pointtype 2 pointsize default
        linetype 3,  linecolor rgb "#56b4e9"  linewidth 1.000 dashtype solid pointtype 3 pointsize default
        linetype 4,  linecolor rgb "#e69f00"  linewidth 1.000 dashtype solid pointtype 4 pointsize default
        linetype 5,  linecolor rgb "#f0e442"  linewidth 1.000 dashtype solid pointtype 5 pointsize default
        linetype 6,  linecolor rgb "#0072b2"  linewidth 1.000 dashtype solid pointtype 6 pointsize default
        linetype 7,  linecolor rgb "#e51e10"  linewidth 1.000 dashtype solid pointtype 7 pointsize default
        linetype 8,  linecolor rgb "black"  linewidth 1.000 dashtype solid pointtype 8 pointsize default
        Linetypes repeat every 8 unless explicitly defined

In gnuplot 5.2 on you get the rgb color values from the current palette into the datablock $PALETTE via test palette. Check help palette.

So if you do:

test palette
print $PALETTE

you will get...

0.0000 0.0000 0.0000 0.0000 0.0000 
0.0039 0.0626 0.0000 0.0246 0.0215 
0.0078 0.0886 0.0000 0.0493 0.0321 
0.0118 0.1085 0.0000 0.0739 0.0409 
0.0157 0.1252 0.0000 0.0984 0.0487 
0.0196 0.1400 0.0000 0.1229 0.0559 
...
0.4941 0.7029 0.1206 0.0370 0.2852 
0.4980 0.7057 0.1235 0.0123 0.2849 
0.5020 0.7085 0.1265 0.0000 0.2861 
0.5059 0.7113 0.1295 0.0000 0.2887 
0.5098 0.7140 0.1325 0.0000 0.2913 
0.5137 0.7167 0.1356 0.0000 0.2939 
0.5176 0.7195 0.1387 0.0000 0.2965 
...
0.9725 0.9862 0.9199 0.0000 0.8348 
0.9765 0.9882 0.9311 0.0000 0.8420 
0.9804 0.9901 0.9423 0.0000 0.8492 
0.9843 0.9921 0.9537 0.0000 0.8565 
0.9882 0.9941 0.9651 0.0000 0.8638 
0.9922 0.9961 0.9767 0.0000 0.8711 
0.9961 0.9980 0.9883 0.0000 0.8785 
1.0000 1.0000 1.0000 0.0000 0.8860 

Then it depends on what you exactly want to do with it.

Addition:

Ok, you are talking about the colors which appear if you type test, correct? That's what I get with a wxt terminal.

enter image description here

There is a file in the gnuplot subfolder share called colors_default.gp.

# Ethan A Merritt - my preference for gnuplot colors
# 2 3 4 5 6 8 are borrowed from the colors_podo set
#
set linetype  1 lc rgb "dark-violet" lw 1
set linetype  2 lc rgb "#009e73" lw 1
set linetype  3 lc rgb "#56b4e9" lw 1
set linetype  4 lc rgb "#e69f00" lw 1
set linetype  5 lc rgb "#f0e442" lw 1
set linetype  6 lc rgb "#0072b2" lw 1
set linetype  7 lc rgb "#e51e10" lw 1
set linetype  8 lc rgb "black"   lw 1
set linetype  9 lc rgb "gray50"  lw 1
set linetype cycle  9

where:

dark-violet = #9400d3
black       = #000000

However, apparently, the colors (in the test screen) are repeated with a cycle of 8.

Related