

When plotting multiple network parameters on the same plot, it is often necessary to distinguish them by selecting plot colors and symbols. You could use this to quickly plot some data without all the bells and whistles, and use the methods described in this section to generate your final plots with all the proper labels. One more thing work mentioning here is that network objects do have a plot_it_all() method that plots all the network quantities on different projections. This makes it rather handy for us to plot any network parameter in the format we want versus frequency without having to deal with network parameter or format conversions ourselves. You can list all the attributes associated with a network object using the dir() function. If you need to plot y-parameters on a complex plane instead, you will use the plot_y_complex() method. For example, using the plot_y_im() method will plot imaginary Y-parameters versus frequency.

The can be quantities like s_db, y_im, or z_deg. Use the plot_ method on any network object to generate a rectangular plot of the attribute versus frequency. In fact, we can generalize plotting in scikit-rf as follows. For each of these plots, you select the appropriate s-parameter using the indices m and n, pass in the appropriate axis handle, and an optional title. Similarly, you can generate a rectangular plot in decibels, polar or complex forms by simply using plot_s_db, plot_s_polar or plot_s_complex. Labels: Setting draw_labels=True shows smith chart axis labels along the real and impedance/admittance axis.VSWR: A nifty visualization in the smith chart is the inclusion of VSWR circles which is enabled using the draw_vswr=True keyword.Legend: If you prefer to turn off the legend in cases when only one curve is present, you can set show_legend=False.Axis: We pass in an axis handle through the ax parameter so that we can place the smith chart in the top left subplot graph.

Type: The smith chart allows impedance or admittance charts depend on whether chart_type is set to z or y, respectively.Radius: r=1 sets the radius of the smith chart to 1, which is the default.Unlike our earlier smith plot, this one shows other arguments that can be passed into the plot function to customize its display. In the other plots, a similar notation is used to select the various s-parameter quantities. We can plot just s11 on the smith chart by setting zero-indexed indices m=0 and n=0 to select it. Otherwise, the polar plot will show up on rectangular axes when this axis handle ( ax3) is passed into the plot function. For the polar plot, the subplot axis handle needs to be created with projection='polar'. The axes handles ax1- ax4 are passed into the plot functions so that we can place the plot appropriately in the plot grid. We generate four subplots corresponding to each s-parameter quantity that needs to be plotted. Various plot types available in scikit-rf plot_s_complex ( m = 1, n = 1, ax = ax4, title = 'S22 complex plane' ) fig. plot_s_polar ( m = 0, n = 1, ax = ax3, title = 'S12 in polar' ) nw. plot_s_smith ( m = 0, n = 0, r = 1, chart_type = 'z', ax = ax1, show_legend = True, draw_labels = True, draw_vswr = True ) nw. add_subplot ( 223, projection = 'polar' ) ax4 = fig. Import matplotlib.pyplot as plt fig = plt. We will use our network object nw created from the touchstone file ntwk1.s2p available as part of the scikit-rf install, that we created earlier as part of this series. The smith chart is central to RF engineering and is the first plot we will address. We will assume a basic familiarity with plotting functions using the matplotlib module which you can learn more about here, if you are unfamiliar. The Network() class has methods that are convenient to use for plotting in rectangular, complex, polar and smith projections. We will limit ourselves to scikit-rf’s built-in plot functions which uses matplotlib under the hood. Plotting tools in python are very powerful and most of them take numpy array data or pandas dataframes as input data structures.
Colored smith chart how to#
Since we have seen how to create and manipulate network data using scikit-rf, visualizing the data is the next logical step. In the fifth post of this series, we will learn how to generate commonly used plots in rf engineering using built-in plot methods in the scikit-rf package.įor your reference, here is a list of articles in this series.
