h3480
h3480

Reputation: 13

How can I plot with transparent lines using gnuplot automatically?

How can I plot with transparent lines using gnuplot automatically?

I plot a histogram with col=adjustcolor(i,alpha.f=0.2) as following in R automatically. I want to do same thing in gnuplot.

hist(rnorm(1000,mean=2),col=adjustcolor(1,alpha.f=0.2),xlim=c(0,10))
for(i in 2:3){
  hist(rnorm(1000,mean=2*i),col=adjustcolor(i,alpha.f=0.2),add=T)
}
legend("topleft",legend=c(1,2,3),col=1:3,lty=1)

histogram plot in R

Upvotes: 1

Views: 1505

Answers (1)

Vinicius Placco
Vinicius Placco

Reputation: 1731

Do you mean you want the histogram to have some transparency? That can be accomplished by using set style fill:

set term png
set out "test.png"

set style fill transparent solid 0.50 border
plot "-" w boxes lc "blue"
1 10
2 12
3 15
4 17
5 15
6 12
7 10
8 08
9 06

Also, if you want the actual line to be transparent, just modify the lc argument:

plot "-" w boxes lc rgb "#80EE6363"

where the first two digits after the # are the transparency, and the next 6 characters are the RGB code for the color you want. Hope it helps!

Upvotes: 1

Related Questions