【问题标题】:Best visualization approach to plot a dataset when there is a big difference between the values (GNUPLOT)当值之间存在很大差异时绘制数据集的最佳可视化方法(GNUPLOT)
【发布时间】:2016-07-08 10:35:14
【问题描述】:

我正在使用以下 gnuplot 脚本来绘制由 400 行组成的数据集

set title "Learning time for the proposed approachs (Freebase)"
set term png
set boxwidth 3
set style fill solid

set output "dbpedia.png"

set ylabel "Learning time (seconds)"
set xlabel "increasing size of the training dataset"
set xtics font ", 9"
set grid

everyfifth(col) = (int(column(col))%10 ==0)?stringcolumn(1):""
plot for [col=2:4] "dbpedia_duration.txt" every 10 using col:xticlabels(everyfifth(0)) with lines lw 2 title columnheader

样本数据集

size DDS-rand DDS-ambig DDS-ambig-NN
10 0.003 0.01 0.046
20 0.004 0.423 2.094
30 0.004 1.768 9.262
40 0.004 5.933 30.649
50 0.003 0.586 2.871
60 0.007 2.282 14.226
70 0.005 0.512 2.707
80 0.007 0.089 0.468
90 0.006 4.61 24.471
100 0.006 3.013 16.411
110 0.006 1.578 8.244
120 0.006 1.194 6.418
130 0.008 2.401 12.398
140 0.008 0.014 0.027
150 0.007 0.284 1.541
160 0.009 1.25 7.598
170 0.012 2.027 11.149


问题和疑问

如您所见,一侧的蓝色曲线与另一侧的红色和绿色曲线之间存在很大差异。在黑白纸上很难看到其他曲线。

有没有更好的方法来绘制这个数据集?这真的很烦人,因为我们几乎看不到红色和绿色的曲线。


更新

如果我们按照@Daniel 的建议使用设置的对数刻度 y,我们确实会得到一个清晰的图表。

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    标准方法是以对数方式绘制 y 轴,这样 0.001、0.01、0.1、1、10、... 的抽动是等距的。

    set logscale y
    

    注意:如果您的数据集包含完全等于零的值,这将不起作用。在这种情况下,您可以使用

    plot 'data.txt' using 1:($2>0? $2 : 1/0)
    

    跳过 y == 零的值(1/0 = 未定义,gnuplot 将跳过)。为您的数据文件调整 x 和 y 的列号。

    【讨论】:

    • 我说@Daniel。它改变了一切。请让我给你看结果
    • 只需在原始问题中添加图片即可。还有什么问题吗?
    • 哦,是的,对不起,对不起。如何在曲线上放置三角形和圆形标志?
    • 尝试“plot 'x' using ... withlinespoints”(而不是“withlines”),然后使用附加选项“pt [1...N]”(pt=pointtype)对于不同的符号。符号取决于您的系统和终端(屏幕与 png 等),因此您只需尝试一下即可。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-26
    • 2018-11-19
    • 2012-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多