Search code examples
loopsgnuplotpalette

Gnuplot: change automatic palette


I have 35 datasets and I plotted them in one chart using the following commands:

set output 'NC_006509.fna.pdf'
set xlabel "Position (kb)"
set ylabel "Identity (%)"
set size 1, 0.25
unset key
set xrange [0:4000]
set yrange [75:101]
filename(n) = sprintf("blast_sample%d_454LargeContigs.fna.fas_vs_NC_006509_filter.txt", n)
plot for [i=1:35] filename(i) using ($9/1000):3:(($10-$9)/1000):($3-$3) with vectors
set xrange [0:GPVAL_DATA_X_MAX]
set terminal pdfcairo font 'Arial, 6'
replot

with the output

enter image description here

Gnuplot automatically colourized each dataset. The problem is that the contrast is not good, since most of the vectors are in light green and yellow in a white background. Is there a way to change the automatic palette of vectors to darker colors (each color representing one dataset)?


Solution

  • There is no option to just darken the default colors.

    To distinguish all 35 lines in a single plot will be impossible in any case. If you only want to visualize the region which is covered by all data sets, and indicate that you have different data sets, you could define an appropriate dark palette and use linecolor palette frac to select different colors.

    As example you could use

    set palette model HSV defined (0 0 1 0.5, 1 1 1 0.5)
    

    which gives (using test palette):

    enter image description here

    To get it working in your script, use

    set palette model HSV defined (0 0 1 0.5, 1 1 1 0.5)
    plot for [i=1:35] filename(i) using ($9/1000):3:(($10-$9)/1000):($3-$3) with vectors linecolor palette frac (i/35.0)
    

    Of course you could also redefine all default linetypes with set linetype, but that is probably more work.