Reputation: 27
I want to have a transparent gradient backgroud in gnuplot. In my script I have some arrows. But, the problem is that when I have a background the arrows are not displayed. Here is the code without background:
set arrow from x1_l, 0 to x1_l, 1.0 nohead lc rgb 'red'
set arrow from x1_r, 0 to x1_r, 1.0 nohead lc rgb 'red'
plot "..\\Points.txt" using 1:2 t "Point" lc rgb "blue"
Here is the output: Plot without background
When I add the background (I need a gradient background) with the following code, the arrow is disappeared.
set table 'shadowkey.dat'
splot [xl:xh] [yl:yh] x/(xh-xl)
unset table
set arrow from x1_l, 0 to x1_l, 1.0 nohead lc rgb 'red'
set arrow from x1_r, 0 to x1_r, 1.0 nohead lc rgb 'red'
unset colorbox
set palette defined (0 "#8888ff", 1 "#ffffff")
plot [0.8:0.95] [0:1] 'shadowkey.dat' w ima, \
"\\Points.txt" using 1:2 t "Point" lc rgb "blue"
Moreover, I want to have a plot where the gradient background will be with two red lines. How can I do that?
Example: Background in a region
Thanks in advance.
Upvotes: 0
Views: 482
Reputation: 3765
use the front
keyword:
set arrow from x1_l, 0 to x1_l, 1.0 nohead lc rgb 'red' front
set arrow from x1_r, 0 to x1_r, 1.0 nohead lc rgb 'red' front
set object 1 rectangle from x1_l, 0 to x1_r, 1.0 fc rgb "cyan" fs solid 1.0 front
to get the gradient just inside the lines:
set table 'shadowkey.dat'
splot [x1_l:x1_r] [0:1] x/(xh-xl)
unset table
maybe better to leave a space between the lines and the gradient:
set table 'shadowkey.dat'
my_val=(x1_r-x1_l)/20
splot [x1_l+my_val:x1_r-my_val] [0:1] x/(xh-xl)
unset table
Here you can find an alternative way to create gradients
Upvotes: 2