Gnuplot xticlabels有几行 [英] Gnuplot xticlabels with several lines
问题描述
如果我添加了xticlabel,它在第二行的中间使用了3行gnuplot剪切. 有什么方法可以让xticlabels包含几行?
if I add a xticlabel that uses 3 lines gnuplot cuts at the middle of the second line. Is there any method to have xticlabels with several lines?
这是我的数据文件:
"[17h30,19h00] 25" 1
"[03h30,10h00] 21" 1
"[03h00,12h00] 26" 2
"[18h00,19h30] 27" 3
"[20h30,22h00] 25" 4
"[13h00,14h30] 25" 4
"[19h30,21h30] 25" 5
"[14h30,16h00] 25" 5
"[16h30,18h00] 25" 5
"[09h30,15h00] 25" 9
这是我的gnuplot代码:
And this is my gnuplot code:
set terminal postscript eps color
set output '| epstopdf --filter --outfile=hist.pdf'
set auto x
set yrange [0:10]
set style histogram clustered
set boxwidth 0.95 relative
set style fill transparent solid 0.5 noborder
plot 'hist.dat' using 2:xticlabels(1) with boxes lc rgb'blue90' notitle
最后这是生成的图形:
推荐答案
潜在问题1:xtics重叠
您可以选择一些方法来解决xtic问题.
Potential Problem 1: xtics overlap
You have a few options to help fix the xtic problem.
set xtics rotate by -45
这将设置xtics以从左上角到右下角的角度打印.
This will set the xtics to print at an angle from top-left to bottom-right.
set xtics font ",4"
您可以使字体变小但不可读.
You could make the font size tiny but unreadable.
set style histogram gap 4
4)更改数据文件
如果您可以控制数据文件,则可以尝试在xtic标签中插入一些换行符,例如
4) Change the data file
If you have control over the data file, you could try inserting some newlines into the xtic labels, e.g.
"17h30\n19h00\n25" 1
潜在问题2:xtics一般时间太长
Potential Problem 2: xtics too long in general
I'm not quite sure from your question, but you may be running into this issue. Gnuplot has a built-in limit for the number of characters in a label, which is set to 50 in older versions of gnuplot and is 200 more recently. The post I linked to includes a workaround, which is to compile a version of gnuplot with an increased MAX_ID_LEN
constant.
这篇关于Gnuplot xticlabels有几行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!