question on clearing axis (ax.clear())
I am noticing the following warning messages when I clear data from a Smith chart plot using ax.clear(). /usr/local/lib/python3.4/dist-packages/smithplot/smithaxes.py:1060: DeprecationWarning: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer. for xs in np.linspace(x0, x1, x_div + 1)[1:]: /usr/local/lib/python3.4/dist-packages/smithplot/smithaxes.py:1064: DeprecationWarning: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer. for ys in np.linspace(y0, y1, y_div + 1)[1:]: #####################################################################################################################
My code follows below and removing the ax.clear() removed the above warning messages. replacing ax.clear() with ax.cla() gave the same results. #############################################################
plot points and/or curves on Smith Chart
def plot_smith(data,canvas=None,figure=None,datatype="reflection",plottype="points",title="",interpolate=0,pointsonly=True): Z0=50. if canvas==None or figure==None: raise ValueError("ERROR! One of canvas or figure missing") if datatype.lower()=="reflection" or datatype.lower()=="r": datatype=SmithAxes.S_PARAMETER elif datatype.lower()=="impedance" or datatype.lower()=="z": datatype=SmithAxes.Z_PARAMETER elif datatype.lower()=="admittance" or datatype.lower()=="y": datatype=SmithAxes.Y_PARAMETER #fig=FigureCanvas(figure=plt.figure(1,figsize=(8,8),frameon=False)) ax = plt.subplot(1, 1, 1, projection='smith') ax.clear() if title!="": ax.set_title(title) data=np.multiply(Z0,data) if len(data)>0: if datatype==SmithAxes.Z_PARAMETER: if pointsonly: # plot data as single points for d in data: ax.plot(d,interpolate=0,datatype=datatype) else: # plot a line ax.plot(np.multiply(Z0,data),interpolate=interpolate,datatype=datatype) elif datatype==SmithAxes.S_PARAMETER: if pointsonly: # plot data as single points for d in data: ax.plot(d,interpolate=0,datatype=datatype) else: ax.plot(data,interpolate=interpolate,datatype=datatype) #ax.hold(False) canvas.draw()
#####################################################################################################################
if I remove the ax.clear() line
Can you provide a more complete test case for your function? Just a bit of sample code that is enough to wrap your function would be enough.
I'm quite confident that I have a fix, but I'd like to produce a test case to verify it before I try to get it pulled back into the project.