当绘图本身具有透明度时,如何使 Gnuplot 中绘图的键不透明?

How can I make the key for a plot in Gnuplot not have transparency when the plot itself has transparency?

我正在尝试制作一个“密度”类型的散点图,其中每个点都是一个透明的圆圈,因此当它们重叠时会形成一个密度图。我用大量的样本来做这个,所以透明度很低,但这意味着不可能看到关键。我可以使密钥的透明度与实际绘图不同吗?

这是我的:

if (!exists("outfile")) outfile='plot.pdf'

set terminal pdf enhanced size 8in, 4.8in
set output outfile

set style fill transparent solid 0.1 noborder
set style circle radius 0.03

plot sample1 u 1:2 w circles, sample2 u 1:2 w circles

只需使用 keyentrywith points pt 7。检查 help keyentry.

代码:

### keyentry
reset session

# create some random test data
set samples 10000
set table $Data1
    plot '+' u (invnorm(rand(0))+1):(invnorm(rand(0))+1) w table
set table $Data2
    plot '+' u (invnorm(rand(0))+4):(invnorm(rand(0))+4) w table
unset table

set style fill transparent solid 0.1 noborder
set style circle radius 0.03

plot $Data1 u 1:2 w circles notitle,\
     $Data2 u 1:2 w circles notitle, \
     keyentry w p pt 7 lc 1 title "Data1", \
     keyentry w p pt 7 lc 2 title "Data2"
### end of code

对于较旧的“pre-keyentry”gnuplot 版本,您可以通过以下方式交换 keyentry 行:

 NaN w p pt 7 lc 1 title "Data1", \
 NaN w p pt 7 lc 2 title "Data2"

结果: