关闭 gnuplot 直方图图例中的选择标题

乔纳森

我想在直方图中绘制数据,其中有两种方法与 2 个不同的实验和每个实验的各种设置进行比较。不同方法/实验的设置相同。下面是我执行此操作的脚本,它是此处找到的示例的变体。

reset
clear

set border 3 front lt black linewidth 1.000 dashtype solid
set boxwidth 0.95 absolute
set style fill solid 1.00
set grid noxtics nomxtics ytics nomytics noztics nomztics nortics nomrtics \
 nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics
set style histogram clustered gap 1 title textcolor lt -1 offset character 2, 0.25
set style data histograms
set xtics border in scale 0,0 nomirror rotate by -45  autojustify
set xtics  norangelimit  font ",8"
set xtics   ()
set ytics border in scale 0,0 mirror norotate  autojustify
set ytics  norangelimit autofreq  font ",8"
set xlabel  offset character 0, -2, 0 font "" textcolor lt -1 norotate
set xrange [ * : * ] noreverse writeback
set ylabel "Percent Success" 
set yrange [ 0 : 100 ] noreverse writeback

plot newhistogram "Approach 1", 'aprch1.dat' using "Setting A":xtic(1) t col lc 1 fs pattern 1, '' u "Setting B" t col lc 2 fs pattern 5, '' u "Setting C" t col lc 3 fs pattern 7, newhistogram "Approach 2", 'aprch2.dat' using "Setting A":xtic(1) t col lc 1 fs pattern 1, '' u "Setting B" t col lc 2 fs pattern 5, '' u "Setting C" t col lc 3 fs pattern 7

这是aprch1.dat的样子。aprch2.dat类似。

Title   "Setting A" "Setting B" "Setting C"
"Experiment 1 " 84.32451898 73.54666118 79.07579357
"Experiment 2 " 84.25763967 45.88435024 42.17414819

这是结果图:

在此处输入图像描述

然而,传说是多余的。如何删除图例中的重复项?

我已经尝试使用notitleand set key noautotitle,如this question中所述,但我遇到了令人讨厌的错误,而不是预期的结果。我承认我并不完全理解脚本中的所有命令。我是否设置了一些不允许我使用的东西,notitle或者是否有更好的方法来获得所需的结果?

汤姆固体

您应该notitle只使用 int 命令的第二部分plot

plot newhistogram "Approach 1", 'aprch1.dat' using "Setting A":xtic(1) t col lc 1 fs pattern 1, '' u "Setting B" t col lc 2 fs pattern 5, '' u "Setting C" t col lc 3 fs pattern 7, newhistogram "Approach 2", 'aprch2.dat' using "Setting A":xtic(1) notitle lc 1 fs pattern 1, '' u "Setting B" notitle lc 2 fs pattern 5, '' u "Setting C"  notitle fs pattern 7

结果

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章