gnuplot,将y轴分为两部分 [英] gnuplot, break y-axis in two parts
本文介绍了gnuplot,将y轴分为两部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有一些小值和一些非常大的值的直方图.如何将y轴分为两个部分?
I have a histogram with some small values and some very big values. How can I break the y-axis in two parts?
gnuplot示例:
gnuplot sample:
set style histogram columnstacked
set style data histograms
set key autotitle columnheader
plot for [i=2:6] 'test.dat' using i
test.dat:
action device1 device2 device3
load 200 203 190 2 4
process 3 9 6 7 3
save 4 2 7 4 3
推荐答案
My answer is based on the example and comment on this website. In essence, you are looking for a broken y-axis, which can be achieved using the multiplot
option:
reset
unset key
bm = 0.15
lm = 0.12
rm = 0.95
gap = 0.03
size = 0.75
kk = 0.5 # relative height of bottom plot
y1 = 0.0; y2 = 15.0; y3 = 180.0; y4 = 220.0
set style histogram columnstacked
set style data histograms
set key autotitle columnheader
set style fill solid 1.0 border -1
set multiplot
set border 1+2+8
set xtics nomirror
set ytics nomirror
set lmargin at screen lm
set rmargin at screen rm
set bmargin at screen bm
set tmargin at screen bm + size * kk
set yrange [y1:y2]
plot for [i=2:6] 'test.dat' using i
unset xtics
unset xlabel
set border 2+4+8
set bmargin at screen bm + size * kk + gap
set tmargin at screen bm + size + gap
set yrange [y3:y4]
plot for [i=2:6] 'test.dat' using i
unset multiplot
备注:
- 第一段代码指定了绘图大小,以及y轴范围的两个最小值/最大值.
- 第二段代码设置您的直方图样式.我建议您使用填充的列(否则,如果将图的y范围截断,则可能会得到错误的颜色).
- 第三个块开始您进入
multiplot
环境并设置下图(第四个块). - 第五段代码定义您的上图.
- 要自定义绘图,请更改第一个块中的参数(
bm
,lm
,rm
,gap
,size
,kk
和yi
)
- The first block of code specifies your plot size, as well as the two min/max for the y-axis range.
- The second block of code sets your histogram style. I suggest you used filled columns (else, you might get the wrong colors where the plot is cut off by the y-range).
- The third block starts you
multiplot
environment and sets up the lower plot (4th block). - The fifth block of code defines you upper plot.
- To customize your plot, change the parameters in the first block (
bm
,lm
,rm
,gap
,size
,kk
andyi
)
这是结果:
这篇关于gnuplot,将y轴分为两部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文