First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
1

Plotting with matplotlib

asked Mar 5 '4

VAAJKAPOOR gravatar image

updated Mar 5 '4

Hi all I am trying to run the script in the forum Plotting help (My forum). However, instead of using PSSPLOT module, I am using matplotlib. While running the code, the code runs successfully until the creation of Excel file but then it gives an error which says that the code cannot run further since the Excel sheet which stored all the data is still open. Is there a way to close the Excel file so that the code can run further? Since I am running this code from command line prompt, is there a way that a separate window opens where I can interactively interact with the created figures like zooming and panning ( if I run the matplotlib code in Spyder IDE, it works by setting the graphics backend to Automatic in IPython Console in Tools)

Any help on this will be appreciated.

Thanks

1 answer

Sort by » oldest newest most voted
0

answered Mar 6 '4

VAAJKAPOOR gravatar image

Hello all!!

A small update regarding interacting with the figures (using command line prompt). It is possible to do so by writing just two lines of code.

plt.ion() # Add this line in the beginning of the code, after importing all the libraries

plt.show(block=True) # Add this line at the end of the code

I am still figuring out closing the Excel file. In the meantime, I am running matplotlib as a separate *.py file, outside of PSSE file.

link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Mar 5 '4

Seen: 1,823 times

Last updated: Mar 05 '24