GNUPLOT传奇带有两个盒子/组和自定义标题

发布于 2025-01-24 20:59:13 字数 543 浏览 3 评论 0原文

我有两种类型的数据/图,我想对它们进行分组以进行澄清。例如,可以说我有这四个数据图

set key box
pl x, x**2, sin(x), cos(x)

,而传奇框则是

但是我想要的是这样的东西(每个组有两个框,每个组的自定义标题)

“

我该怎么做? GNUPLOT是否可以使用这种传说?

I have two types of data/plot and I want to group them for clarification. For example, lets say I have this four data plots

set key box
pl x, x**2, sin(x), cos(x)

And the legend box comes out to be something like
enter image description here

But what I want is something like this, (with two box for each group and a custom heading for each group)

what_I_want

How do I do this? Is this type of legend possible with gnuplot?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

染火枫林 2025-01-31 20:59:14

我担心,为此,gnuplot中没有囊液解决方案。但是您可以尝试多层

set key box
set key width 3

set multiplot

set key at screen 0.45,0.95
set key title "Polynomial"

plot[-10:10][-20:100] x t 'x', x**2 t 'x^2'

set key at screen 0.65,0.95
set key title "Trigonometrical"

plot[-10:10][-20:100] sin(x) lc 3, cos(x) lc 4

unset multiplot

​代码>和第二个图的边界。例如。:

set key box
set key width 3

set multiplot

set lmargin screen 0.05
set rmargin screen 0.95
set bmargin screen 0.05
set tmargin screen 0.95
set key at screen 0.45,0.95
set key title "Polynomial"
set tics
set border

plot[-10:10][-20:100] x t 'x', x**2 t 'x^2'

set key at screen 0.65,0.95
set key title "Trigonometrical"
unset tics
set border 0

plot[-10:10][-20:100] sin(x) lc 3, cos(x) lc 4

unset multiplot

I fear, that there is no bulit-in solution in Gnuplot for that. But you can try with multiplot:

set key box
set key width 3

set multiplot

set key at screen 0.45,0.95
set key title "Polynomial"

plot[-10:10][-20:100] x t 'x', x**2 t 'x^2'

set key at screen 0.65,0.95
set key title "Trigonometrical"

plot[-10:10][-20:100] sin(x) lc 3, cos(x) lc 4

unset multiplot

Result

EDIT

As Eldrad wrote, you can fine tuning this solution by setting the margins and unsetting the tics and border of the second plot. Eg.:

set key box
set key width 3

set multiplot

set lmargin screen 0.05
set rmargin screen 0.95
set bmargin screen 0.05
set tmargin screen 0.95
set key at screen 0.45,0.95
set key title "Polynomial"
set tics
set border

plot[-10:10][-20:100] x t 'x', x**2 t 'x^2'

set key at screen 0.65,0.95
set key title "Trigonometrical"
unset tics
set border 0

plot[-10:10][-20:100] sin(x) lc 3, cos(x) lc 4

unset multiplot
宁愿没拥抱 2025-01-31 20:59:13

没有直接创建两个键的直接选择,但是肯定有几种解决方法需要手动调整。一种方法可能是创建一个两柱键:

set key maxrows 3 width 5
plot keyentry t "Polynomial", x t "x", x**2 t "x²", keyentry t "Trigonometry", sin(x), cos(x)

”“在此处输入图像说明”

另一种方法可能基于手册中的多个键部分。

There is no straightforward option to create two keys, but there are definitely several workarounds that will need manual adjustment. One approach could be creating a two-column key:

set key maxrows 3 width 5
plot keyentry t "Polynomial", x t "x", x**2 t "x²", keyentry t "Trigonometry", sin(x), cos(x)

enter image description here

Another approach might be based on the multiple keys section in the manual.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文