简体   繁体   English

gnuplot 和绘图上任何一般位置(例如“标题”区域)中的“额外”图形对象(如点或圆)

[英]gnuplot and "extra" graphics objects (like a dot or circle) in any general location on plot (e.g. in the "title" area)

Consider the following example script:考虑以下示例脚本:

reset session
set multiplot layout 1,2
set title "."
plot sin(x)
set title "."
plot sin(x**2)
unset multiplot

... one can see that the set title "." ... 可以看到set title "." is a kludge for, ideally, a nicer dot - perhaps what is called a "bulletpoint".理想情况下,这是一个更好的点 - 也许是所谓的“要点”。 While I could pursue this kludge, using O , or other font sizes, point sizes, or {/Symbol } (in progress), or terminals of the LaTeX variety (because there are pretty good mathematical symbols I could use like cdot ), it would be interesting to know in general - a simple shape like a dot or square, imposed somewhere on the plot, but outside the usual set title or label which have certain rules with the fonts and such.虽然我可以使用O或其他字体大小、磅值或{/Symbol } (进行中)或 LaTeX 品种的终端(因为有一些非常好的数学符号我可以使用,如cdot )来解决这个问题,但它一般情况下会很有趣 - 一个简单的形状,如点或正方形,强加在情节的某处,但在通常set title或标签之外,这些标题或label具有某些字体等规则。

It's still not fully clear to me what you want to achieve.我仍然不完全清楚你想要实现什么。 Placing a point which tunable size as title or at the place where the title usually would be?将可调大小的点作为标题放置或放置在标题通常所在的位置? You can use set label with option point (check help label ).您可以将set label与选项point一起使用(检查help label )。 You can set different point types, type test in the gnuplot console to see the available pointtypes.您可以设置不同的点类型,在 gnuplot 控制台中键入test以查看可用的点类型。 It's not clear, why you wrote that you don't want to use labels.目前还不清楚,为什么你写的是你不想使用标签。 Maybe with the example below we'll get a step further.也许通过下面的例子我们会更进一步。

Script:脚本:

### place a point somewhere on the canvas
reset session

set multiplot layout 1,2

    set title "."
    plot sin(x)
    
    set title " "
    set label 1 at graph 0.2,1.05 point pt 7 ps 0.25 lc "dark-violet"
    set label 2 at graph 0.3,1.05 point pt 7 ps 0.50 lc "blue"
    set label 3 at graph 0.4,1.05 point pt 7 ps 0.75 lc "cyan"
    set label 4 at graph 0.5,1.05 point pt 7 ps 1.00 lc "green"
    set label 5 at graph 0.6,1.05 point pt 7 ps 1.25 lc "yellow"
    set label 6 at graph 0.7,1.05 point pt 7 ps 1.50 lc "orange"
    set label 7 at graph 0.8,1.05 point pt 7 ps 1.75 lc "red"
    plot sin(x**2)

unset multiplot
### end of script

Result:结果:

在此处输入图像描述

  1. You can place a graphical object (drawn with vectors and/or solid fill) using the command set object {circle|rectangle|polygon} at... .您可以使用命令set object {circle|rectangle|polygon} at...放置图形对象(用矢量和/或实体填充绘制)。 See User Manual or interactive help for details.有关详细信息,请参阅用户手册或交互式help

  2. You can use any unicode character including math symbols and even emojis in a title or label.您可以在标题或标签中使用任何 Unicode 字符,包括数学符号甚至表情符号。 Yes, you must have a font available that contains that character, but these days that is not much of a limitation.是的,您必须拥有包含该字符的可用字体,但如今这已不是什么限制。 For example:例如:

    set title "Various solar symbols: ☀☼☉"

Even if you have trouble entering the desired symbol via keyboard or cut-and-paste, current gnuplot allows you to specify the unicode symbol as an escape sequence:即使您无法通过键盘或剪切和粘贴输入所需的符号,当前的 gnuplot 也允许您将 unicode 符号指定为转义序列:

 set label 1 "Solar symbol" at graph 0.5, 1.0 point pointtype "\U+2609"
 set border 3; unset tics
 plot 1/exp(x) notitle

在此处输入图像描述

I gathered these approaches in a demonstration script the sin(x) functions are just for show:我在演示脚本中收集了这些方法,sin(x) 函数仅用于展示:

reset session
unset key
#
set grid x,y
set style fill solid 1.0
set multiplot layout 2,2
#
set title "."
plot 1*sin(x)
unset title
#
set title "O"
plot 2*sin(x)
unset title
unset object
#
# series of objects
# only valid on on the specific plot area
# not outside the e.g. axes or border
set object circle at 1,1
set object circle at 1,2
set object circle at 1,3
plot 3*sin(x)
unset object
#
set label 1 at graph -0.1,1.10 point pt 7 ps 1.00 lc "black"
set label 2 at graph  0.0,1.10 point pt 7 ps 1.00 lc "black"
set label 3 at graph  0.5,1.05 point pt 7 ps 1.00 lc "black"
set label 4 at graph  0.5,1.10 point pt 7 ps 1.00 lc "black"
plot 4*sin(x)
unset label
#
unset multiplot
unset output

I couldn't get fill style solid 1.0 to work on set object circle the way I wanted so I left it, perhaps there is a way.我无法让fill style solid 1.0以我想要的方式在set object circle上工作,所以我离开了它,也许有办法。 One can see the circle gets cut off on the edge.可以看到圆圈的边缘被切断了。 The label coordinates also have requirements (see manual).标签坐标也有要求(见手册)。

To be clear, I am writing this "answer" but the question is only "answered" because of theozh and Ethan (thanks.).需要明确的是,我正在写这个“答案”,但这个问题只是因为 theozh 和 Ethan(谢谢)而被“回答”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在R中,是否可以在绘图中叠加2种颜色以产生第3种颜色(例如,使用加法或减色混合) - In R, is it possible to overlay 2 colours in a plot to make a 3rd (e.g. with additive or subtractive colour mixing) JApplet不使用paintComponent(Graphics g)方法绘制圆 - JApplet does not draw circle with paintComponent(Graphics g) method 创建图像统计信息(例如,常用颜色...) - create statistics on image (e.g. mostly used color…) julia 是否有高级通用图形库? - Are there any high level general purpose graphics libraries for julia? 如何使用paintComponent(Graphics g)绘制存储在向量中的对象 - How to draw objects stored in a vector with paintComponent(Graphics g) gnuplot - 如何保存与我在 xterminal 中设计的图形相同的图形文件? - gnuplot - How can I save a graphics file of a plot that is the same as I designed it in xterminal? Unity3D:创建室内场景,例如教室或道场 - Unity3D: creating an indoor scene e.g. classroom or dojo 问:如何为QLabel创建清晰可见的发光效果? (例如使用QGraphicsDropShadowEffect) - Qt: How to create a clearly visible glow effect for a QLabel? (e.g. using QGraphicsDropShadowEffect) 弹跳矩形(图形g) - Bouncing rectangle (Graphics g) 如何初始化图形g? - How to initialize Graphics g?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM