martynwheeler / DiodeModel

Python Script for producing a SPICE model of a diode from a characteristic
MIT License
13 stars 3 forks source link

Matplotlib has deprecated set_window_title #1

Open mundodisco8 opened 1 year ago

mundodisco8 commented 1 year ago

Hi!

I downloaded your script recently. When I installed the dependencies, I installed the latest, and things have changed I guess since you wrote your script.

Running it will give you this output

python DiodeModel.py examples\1N4001.dat

Fit converged in 163 iterations with the following parameters
IS = 1.0965794560509742e-08
N = 1.869692000878504
RS = -0.1276334792061565
Traceback (most recent call last):
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Jupyter Test\DiodeModel-master\DiodeModel.py", line 127, in <module>
    main()
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Jupyter Test\DiodeModel-master\DiodeModel.py", line 120, in main
    plot(xdata, ydata, args.npoints, popt[0], popt[1], popt[2])
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Jupyter Test\DiodeModel-master\DiodeModel.py", line 32, in plot
    plt.figure().set_window_title('Plot Window')
AttributeError: 'Figure' object has no attribute 'set_window_title'. Did you mean: 'get_window_extent'?

You still get the parameters, but you don't get the graph. Can be easily fixed by changing a line.

RolandWa commented 2 months ago

Please update code :

Plot the data and model

#plt.figure().canvas.set_window_title('Plot Window')
plt.get_current_fig_manager().set_window_title('Plot Window')