关闭gnuplot直方图中的精选标题

发布于 2025-01-24 17:45:06 字数 2283 浏览 1 评论 0原文

我想在直方图中绘制数据,其中有两种方法与每个实验的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

这是结果图:

”在此处输入图像描述”

但是,传说是多余的。如何删除传奇中的重复项?

我尝试使用NotiTle设置键NoAutotitle,如标题“>这个问题,但我遇到了讨厌的错误,而不是所需的结果。我会承认,我不完全理解脚本中的所有命令。我是设置不允许我使用NotiTle的东西还是有更好的方法来获得所需的结果?

I want to plot data in a histogram where there are two approaches being compared with 2 different experiments and various settings for each experiment. The settings are the same across different approaches / experiments. Below is my script for doing this, which is a variation of the example found here.

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

Here is what aprch1.dat looks like. aprch2.dat is similar.

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

Here is the resulting graph:

enter image description here

However, the legend is redundant. How do I remove the duplicates in the legend?

I have tried using notitle and set key noautotitle, as described in this question, but I'm getting nasty errors and not the desired result. I will admit that I do not totally understand all of the commands in the script. Am I setting something that doesn't allow me to use notitle or is there a better approach to get the desired result?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

似最初 2025-01-31 17:45:06

您应该使用NotiTle仅在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

”

You should use notitle only int the second part of the plot command:

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

Result

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文