简体   繁体   中英

How does Ipython matplotlib interactive mode work?

I am trying to learn matplotlib using Ipython but can't work out how interactive mode works.

There is a similar question here

Exact semantics of Matplotlib's "interactive mode" (ion(), ioff())?

but the referenced discussion link is broken.

I start Ipython using

ipython --pylab

then

figure()
title('Title')

works interactively, but

fig=figure()
fig.suptitle('Suptitle')

requires a

draw()

to update in the figure window.

Why are these responses different? If I have two figures how do I cause them both to update interactively? Do I have to call draw() every time?

interactive mode is not really useful when you are using ipython because it already knows when to display the plots.

It is more usefull when you are using a normal python shell and you will be able to control when the figures pop up.

with ion() the plots will pop up as soon as you make them.

with ioff() the plots will not pop up until you call plt.show().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM