plukic plukic - 1 year ago 433
Python Question

Plotting Smith chart using PySmithPlot

I'm trying to plot Smith chart in python using PySmithPlot, it has to be placed along some other items in frame, but i can't find a way to do so.
I have managed to make plots with matplotlib, but didn't have any luck so far with Smiths chart. Can anyone give me a reference to a site where i could find explanation to my problem?

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
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")

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

class Home(tk.Frame):

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

app = Dizajn()

And this is the last line of error report
in transform_path_non_affine
NotImplementedError: Value for 'path_interpolation' cannot be interpreted.

Answer Source

PySmithPlot provides a new projection which you can pass to e.g. subplot() or 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')

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download