gpt4 book ai didi

plot - 在 Gnuplot 中绘制 "with labels"时如何证明标签合理?

转载 作者:行者123 更新时间:2023-12-04 15:04:37 25 4
gpt4 key购买 nike

下面的 plot 命令生成一个条形图,在每个条形上方将值绘制为标签,格式为 gprintf:

plot "data.txt" using 6:1 index 0 notitle with boxes linestyle 1,\
"data.txt" using 6:(0.7):(gprintf("%5.2f", $1)) index 0 notitle \
with labels font "Courier,34" rotate left

我希望值标签右对齐,以便我可以使用更好看的 Helvetica 字体而不是 Courier 来对齐小数点。

那么,如何在上述命令中包含理由?

我未能在 Gnuplot 文档或 Web 上找到有关此特定问题的任何信息。其他标签可以很容易地证明是合理的,但是在使用标签绘图时是否也可能?

最佳答案

我无法测试您的特定示例,但我的示例如下:

...
plot "test.dat" using ..., \
"" using ($1-100000):2:3 with labels rotate left notitle
...

...其中“ rotate left”部分取自OP。

好吧,我没有太多运气在网上找到有关标签“对齐”或“理由”的信息;所以我试图查看在线 gnuplot 帮助。基本上相关的东西都在 help set label下面- 我不确定我到底是怎么做到的,但下面是我的命令日志;

$ gnuplot...    G N U P L O T    Version 4.4 patchlevel 2...Terminal type set to 'wxt'gnuplot> help with labelsSorry, no help for 'with labels'gnuplot> help with  Functions and data may be displayed in one of a large number of styles. The `with` keyword provides the means of selection. Syntax:       with  { {linestyle | ls }...where  is one of      lines        dots       steps     errorbars     xerrorbar    xyerrorlines      points       impulses   fsteps    errorlines    xerrorlines  yerrorbars      linespoints  labels  ......gnuplot> help labels The `labels` style reads coordinates and text from a data file and places the text string at the corresponding 2D or 3D position.  3 or 4 input columns of basic data are required.  ....      3 columns:  x  y  string    # 2D version... See also `datastrings`, `set style data`.gnuplot> help set label Arbitrary labels can be placed on the plot using the `set label` command. Syntax:       set label {} {""} {at }                 {left | center | right}                 {norotate | rotate {by }}                 ... By default, the text is placed flush left against the point x,y,z.  To adjust the way the label is positioned with respect to the point x,y,z, add the justification parameter, which may be `left`, `right` or `center`, indicating that the point is to be at the left, right or center of the text. Labels outside the plotted boundaries are permitted but may interfere with axis labels or other text. If `rotate` is given, the label is written vertically (if the terminal can do so, of course).  If `rotate by ` is given, conforming terminals will try to write the text at the specified angle; non-conforming terminals will treat this as vertical text.


相关部分加粗;他们解释了我的一个误解 - 看到了 rotate left在 OP 示例中,我认为 leftrotate 的属性,但它不是 - left是一个单独的对齐参数,而 rotate是一个单独的旋转关键字(即 rotate left 并不意味着我最初认为的“逆时针旋转 90 度”)。

如果是这样,则可以反转这两个关键字:
...
plot "test.dat" using ..., \
"" using ($1-100000):2:3 with labels left rotate notitle
...

...并获得完全相同的输出图。如果最后我们替换 leftright ,如:
...
plot "test.dat" using ..., \
"" using ($1-100000):2:3 with labels right rotate notitle
...

...我们可以看到标签仍然“向左”旋转(逆时针 90 度) - 但是,它现在与位置右对齐。

嗯,希望这有帮助,
干杯!

关于plot - 在 Gnuplot 中绘制 "with labels"时如何证明标签合理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3439341/

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