gpt4 book ai didi

linux - gnuplot 在 x2 上显示 y2 值

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:02:29 24 4
gpt4 key购买 nike

我有下图:

  • 第一个数据集显示搜索。
  • 第二个数据集显示点击次数。

y1 显示搜索比例,y2 显示点击比例。在 x1 上我显示了时间值。

我希望在 x2(上轴)上显示点击值(每小时)。当我添加命令 set x2tics 时,它会显示搜索数据,而不是我希望的点击次数。

如何更改它以显示点击次数单位?

Gnuplot 脚本:

set xlabel "Time"
set ylabel "Times"
set y2range [0:55000]
set y2tics 0, 1000
set ytics nomirror
set datafile separator "|"
set title "History of searches"
set xdata time # The x axis data is time
set timefmt "%Y-%m-%d %H:%M" # The dates in the file look like 10-Jun-04
set format x "%d/%m\n%H:%M"
set grid
set terminal png size 1024,768 # gnuplot recommends setting terminal before output
set output "outputFILE.png" # The output filename; to be set after setting
# terminal
load "labelsFILE"

plot 'goodFILE' using 1:3 lt 2 with lines t 'Success' , 'clicksFILE' using 1:2 lt 5 with lines t 'Clicks right Y' axis x1y2


replot

图表:

graph http://img42.imageshack.us/img42/1269/wu0b.png

最佳答案

好的,开始吧,下面是如何设置带有点击次数的标签,如下所示(使用您的数据文件名):

plot 'goodFILE' using 1:3 lt 2 with lines t 'Success',\
'clicksFILE' using 1:2 lt 5 with lines t 'Clicks right Y' axis x1y2,\
'' using 1:2:(sprintf("%dk", int($2/1000.0))) with labels axis x1y2 offset 0,1 t ''

只需将其添加为绘图命令,它就可以正常工作。

为了说明标签的外观,这里有一个带有一些虚拟数据的示例:

set terminal pngcairo
set output 'blubb.png'

set xlabel "Time"
set ylabel "Times"
set y2label "Clicks per hour"
set y2range [0:10000]
set yrange [0:1]
set ytics nomirror
set y2tics
set key left

set samples 11
set xrange[0:10000]
plot '+' using 1:1:(sprintf("%dk", int($1/1000.0))) every ::1::9 with labels axis x1y2 offset 0,1 t '',\
'' using 1:1 with linespoints axis x1y2 pt 7 t 'Clicks per hour'

这给了你:

enter image description here

关于linux - gnuplot 在 x2 上显示 y2 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18463554/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com