使用PySmithPlot绘制史密斯圆图

时间:2016-10-08 15:38:31

标签: python matplotlib

我正在尝试使用PySmithPlot在python中绘制史密斯图表,它必须与框架中的其他项目放置,但我找不到这样做的方法。 我已经设法用matplotlib制作情节,但到目前为止史密斯图表没有任何运气。任何人都可以给我一个网站的参考,我可以找到我的问题的解释?

import matplotlib as mp
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
import tkinter as tk
from tkinter import ttk
from matplotlib import style
from PIL import Image, ImageTk
from matplotlib.figure import Figure
from tkinter import Tk, W, E
from tkinter.ttk import Frame, Button, Style, Entry
from matplotlib import pyplot as plt
import matplotlib.pylab as pl
import smithplot
from smithplot import SmithAxes
mp.use("TkAgg")
f = Figure(figsize=(5, 5), dpi=100)
class Dizajn(tk.Tk):

    def __init__(self, *args, **kwargs):
    tk.Tk.__init__(self, *args, **kwargs)
    tk.Tk.wm_title(self, "title")
    container = tk.Frame(self)
    container.pack(side="top", fill="both", expand=True)
    container.grid_rowconfigure(0, weight=1)
    container.grid_columnconfigure(0, weight=1)
    self.frames = {}
    for F in (Home, FirstPage):
        frame = F(container, self)
        self.frames[F] = frame
        frame.grid(row=0, column=0, sticky="nsew")
    self.show_frame(Home)

def show_frame(self, cont):
    frame = self.frames[cont]
    frame.tkraise()

class Home(tk.Frame):

    def __init__(self, parent, cont):
        tk.Frame.__init__(self, parent)
        ax = f.add_subplot(111, projection="smith")
        pl.show()
        self.grid()

app = Dizajn()
app.mainloop()

这是错误报告的最后一行 在transform_path_non_affine中 NotImplementedError:无法解释'path_interpolation'的值。

1 个答案:

答案 0 :(得分:2)

PySmithPlot提供了一个新的projection,您可以将其传递到subplot()add_subplot()

import matplotlib.pylab as pl 
import smithplot
from smithplot import SmithAxes

fig = pl.figure() 
ax1 = fig.add_subplot(121) 
ax1.plot([(1, 2), (3, 4)], [(4, 3), (2, 3)]) 
ax2 = fig.add_subplot(122, projection='smith') 
pl.show()

enter image description here