通过Python实现Gnuplot中的Multiplot

2024-09-29 23:16:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用multiplot得到三个图表,一个在一个下。在

我试过了:

#! /usr/bin/env python
from numpy import *
import Gnuplot as gp
import Gnuplot.funcutils

x = (1,2,3)
y=(2,4,5)
x1 = (3,6,8)
g = gp.Gnuplot()
g("set output 'filename.svg'")
g("unset xtics")
g("unset ytics")
g("set size 200,200")
g("set bmargin 0")
g("set tmargin 0")
g("set lmargin 0")
g("set rmargin 0")

g("set multiplot")
#First
g("set origin 0.1,0.1")
d = gp.Data(x,y,with_="linespoints")
g.plot(d)
#Second
g("set origin 0.1,50")
d1 = gp.Data(x1,y,with_="linespoints")
g.plot(d1)
# Third
g("set origin 0.1,100")
d2 = gp.Data(y,x,with_="linespoints")
g.plot(d2)
g("unset multiplot")

http://t16web.lanl.gov/Kawano/gnuplot/plot3-e.html开始

但是当我想显示所创建的svg时会出现一个错误。 建议? 食品饮料


Tags: svgimportdataplotwithorigind2d1
1条回答
网友
1楼 · 发布于 2024-09-29 23:16:31

问题是你没有设置终端。Gnuplot只是将输出发送到x11终端(或者您配置为默认值的任何东西)。如果您的默认终端不是svg,那么您将得到一个错误,要么文件不存在,要么编码类型与svg扩展名不匹配。在

g("set output 'filename.svg'")之前加上g("set terminal svg"),你应该都准备好了。在

相关问题 更多 >

    热门问题