gpt4 book ai didi

linux - Gnuplot 4.6 xtics 标签消失

转载 作者:太空狗 更新时间:2023-10-29 11:09:52 27 4
gpt4 key购买 nike

我决定从 4.4 迁移到最新版本的 gnuplot 到 4.6我遇到了 x 标签在 4.6 版中消失但在 4.4 版中出现的问题。

这是我的脚本的精简版。

set key outside
set title "MY TITLE"
set timefmt "%m/%d/%Y-%H:%M:%S"
set format x "%m/%d %H:%M"
set xdata time
set ylabel "Y LABEL"
set xlabel "Time"
set grid
set xtics rotate by 90 offset 0,-5
set terminal pngcairo size 1000,500 font ",9"
set xtics font ",8.0"
set ytics font ",8.0"
set output 'test.png'
plot '-' using 1:2 with linespoints ti "legend"
01/01/2013-00:15 186557
01/01/2013-01:15 254654
01/01/2013-04:00 180146
01/01/2013-06:15 191059
e
set key inside

我已经确定了这一行的问题

set xtics rotate by 90 offset 0,-5

因为我的标签太长,偏移量使它消失了

如果你删除偏移到

set xtics rotate by 90

不是标签显示而是在图表中间。

4.4版本用于压缩图表,为标签留出空间。

我想我对 gnuplot 的了解是有限的。有人有想法吗?

谢谢

最佳答案

更新的答案,由 Ethan Merritt 提供

更好的方法是将标签的对齐方式更改为右对齐(而不是默认居中)。

set xtics rotate by 90 right

这无需硬编码边距大小即可正确计算边距


我觉得这里的标签位置有点不稳定。我认为可能存在一个我可能会报告的错误。一种解决方法是通过以下方式显式设置“x 轴”的位置:

set bmargin at screen 0.2

它看起来很古怪的原因是因为 set bmargin at screen 0.2,xtic 标签明显延伸到高于 xlabel 的位置。但是,如果您注释掉该行,突然之间它们不会延伸到 xlabel 的位置之上。

下面是有和没有那条线的图:

enter image description here

enter image description here

也许 cairo/pango 在标签的任何部分超出可见“ Canvas ”区域的地方剪下标签?

作为旁注,如果我使用 postscript 终端,情节似乎也大致正确......

关于linux - Gnuplot 4.6 xtics 标签消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14148342/

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