Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot: line opacity / transparency?

Tags:

gnuplot

I am using Gnuplot to successfully plot some time series data. However, the series are fairly dense (10,000's of samples in about 5 inches of space), and when I plot multiple series, it is hard to see underneath the series that was plotted on top. Is there any way to make the lines have a bit of opacity or transparency (i.e. make the line transparent so underneath lines are visible)?

Excel has this capability, but I would much prefer to use Gnuplot.

Below is a sample of what I'm talking about. You can't see the red lines under the green lines. I would actually like to add a third time series. I am plotting with the command:

plot [][-3:3] 'samples_all.csv' using 1:7 title 'horizontal' w l ls 1, '' using 1:8 title 'vertical' w l ls 2"

enter image description here

like image 760
stackoverflowuser2010 Avatar asked Sep 07 '12 21:09

stackoverflowuser2010


1 Answers

Good news! This has been implemented in gnuplot. Example syntax is

plot x lw 10, -x lw 10 lc rgb "#77000000"

This will plot x as a red line and -x as a transparent black line (it looks gray). The first pair of two characters in the rgb specification define the alpha (transparency) channel ("#AARRGGBB"). The normal syntax ("#RRGGBB") still works.

old (gnuplot < 5.0 or so) answer for reference:

If you want to make lines plotted for time series data, the answer is no (see discussion here). You can't set a line style to be transparent. Transparency only works for filling under curves, and it has to be printed to the right terminal type.

I ran into this problem myself recently, I hope this feature will be added in a future version of gnuplot.

like image 59
andyras Avatar answered Jan 02 '23 05:01

andyras