Yesterday we talk about
shadow to a curve in gnuplot . But the key is not plotted. Now we come to add a shadowed key to our graph. The method is the same as before, plotting the objects two or more times. The following is an example gnuplot script.
reset
set term png
set output "shadowkey.png"
dy=0.75
angle=pi/6.0
dx=dy*tan(angle)
f(x)=0.1*(x10)*x*(x+10)
set object 1 rectangle from graph 0.91,0.89 \
to graph 0.66,0.74 fillstyle solid 1.0 noborder \
fc rgb"#cccccc" #keybox shadow
set object 2 rectangle from graph 0.9,0.9 \
to graph 0.65,0.75 fc rgb"#ffffff" #keybox
set arrow 1 lw 7 lc rgb"#cccccc" from graph 0.78,0.82 \
to graph 0.86,0.82 nohead #samleline shadow
set arrow 2 lw 7 lc rgb"red" from graph 0.77,0.83 \
to graph 0.85,0.83 nohead #sampleline
set label 1 "f(x)" at graph 0.7,0.83 #key label
set xrange [15:15]
plot f(xdx)dy w l lw 7 lc rgb"#cccccc" notitle,\
f(x) w l lw 7 lc rgb"red" notitle
Because gnuplot can not give us enough control on the key by using command "set key ...", in this script we draw the key manually using rectangles,arrows and label. The final appearance of shadow1.png is shown below.

Shadow to the key in gnuplot 
No comments:
Post a Comment