4247

Avoiding

I am trying to plot a series of functions on the same graphs. The code seems to run ok, but there is no picture coming coming out. just simply

<matplotlib.figure.Figure at 0xeafea58>

How can it be fixed?

Answer1:

In the IPython console, the best way to make sure figures show up (without explicitly calling plt.show()) is to use %matplotlib mode. If matplotlib is installed correctly, it should automatically choose a suitable backend for your system.

For example:

In [1]: import matplotlib.pyplot as plt In [2]: plt.plot([1, 2, 3]) # no plot shown! Out[2]: [<matplotlib.lines.Line2D at 0x110eac898>] In [3]: %matplotlib Using matplotlib backend: MacOSX In [4]: plt.plot([1, 2, 3]) # plot shown now Out[4]: [<matplotlib.lines.Line2D at 0x112174400>]

<img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/a00eo.png" alt="enter image description here">

The %matplotlib magic command only needs to be entered once per session.

Recommend

  • Storing workspace variable in GUI for use by other push buttons. MATLAB GUI
  • Magento: How do I find out if a Sales Rule coupon exists for a product/item
  • In .NET, is it better to call .Count() or, when available, .Count?
  • Count Failures in PowerBI
  • for loop with ggplots produces graphs with identical values but different headings
  • How do I rank a list in vanilla Python?
  • Preparing publication-quality figures in R with more than one panel [duplicate]
  • JavaScript - Binary search hangs every time
  • How to add graphics on top of a multiscaleimage?
  • matplotlib not using matplotlibrc file in IPython
  • Apache Flink read Avro byte[] from Kafka
  • I used to be able to get a receiver list in the Chromecast beta, now I can't… Am I missing some
  • Can't install scipy
  • iPython Notebook not printing Dataframe as table
  • Matplotlib rotate image file by X degrees
  • How to set a thread specific environment variable in Python?
  • Python multiprocessing of a sum
  • Python adding lots of things to PATH. How do I stop?
  • Reading space separated values file in c++ error
  • why calling cd shell command through system() or execvp() from a child process won't work?
  • cell spacing in div table
  • Symfony 2 error page response
  • XSLT foreach repeating nodes to flat
  • How to create a 2D image by rotating 1D vector of numbers around its center element?
  • Which open source license has no forking [closed]
  • How to explicitly/implicitly implemented interface members in C++/CLI?
  • Thread 1: EXC_BAD_ACCESS (code =1 address = 0x0)
  • Set matplotlib plot axis to be the dataframe column name
  • $wpdb not working in file of WordPress plugin
  • QLineEdit password safety
  • RectangularRangeIndicator format like triangular using dojo
  • Upload files with Ajax and Jquery
  • Why winpcap requires both .lib and .dll to run?
  • How to pass list parameters for each object using Spring MVC?
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • Proper way to use connect-multiparty with express.js?
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?