gnuplot:柱状图所需的直方图

时间:2018-05-18 11:31:12

标签: gnuplot

Output Should be something like this

任何人都可以帮我一个示例代码来为下面的数据构建直方图。我对此非常陌生,非常感谢你的帮助。

SELECT * FROM
  (SELECT CATS_W_TIMESTAMPS_KEY, SPLIT( VALUES, ",")
   AS VALUES, TAG_URI, PIXEL_URL, REFERRER, CAMPAIGN_ID, WIN_TIME, OBFS_BKUUID, PIXEL_ID, IP_ADDRESS, DATA_DATE, PROCESS_DATE, TRACK_ID
FROM
    (SELECT FIRST(SPLIT(CATS_W_TIMESTAMPS, ":")) AS CATS_W_TIMESTAMPS_KEY, NTH(2, SPLIT(CATS_W_TIMESTAMPS, ":")) AS
      VALUES, TAG_URI, PIXEL_URL, REFERRER, CAMPAIGN_ID, WIN_TIME, OBFS_BKUUID, PIXEL_ID, IP_ADDRESS, DATA_DATE, PROCESS_DATE, TRACK_ID
      FROM
        (SELECT *
         FROM
           (SELECT SPLIT(CATS_W_TIMESTAMPS, ';') AS CATS_W_TIMESTAMPS, TAG_URI, PIXEL_URL, REFERRER, CAMPAIGN_ID, WIN_TIME, OBFS_BKUUID, PIXEL_ID, IP_ADDRESS, DATA_DATE, PROCESS_DATE, TRACK_ID
            FROM [sample_dataset.test_table_1]
            WHERE _PARTITIONTIME>=$PARTITIONDATE )
         GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)))
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13

1 个答案:

答案 0 :(得分:0)

看起来并不好,但这是一个开始。首先,我将数据保存到文件“so-dat.txt”中,如图所示。然后我使用了这个gnuplot脚本。

set boxwidth 0.9 absolute
set style fill   solid 1.00 border lt -1
set key right top vertical Right noreverse noenhanced autotitle nobox
set style histogram clustered gap 1 title textcolor lt -1
set datafile missing '-'
set style data histograms
set xtics border in scale 0,0 nomirror rotate by -45  autojustify
set xtics  norangelimit 
set xtics   ()
set title "data" 
set yrange [ 0.00000 : 45000. ] noreverse nowriteback
## Last datafile plotted: "immigration.dat"
plot 'so-dat.txt' using 2:xtic(1) ti col, '' u 3 ti col, '' u 4 ti col, '' u 5 ti col

创建一个条形图,其中包含3个(按日期)四列的集群(总成功Gen_decline failure_incomplete。)

使键水平。

set key right horizontal noenhanced autotitle nobox

甚至可以设置上面的键。虽然这高于标题。

set key above horizontal autotitle nobox