The first command in my Jupyter notebook is the %matplotlib notebook. This has been working fine but curiously the figures being drawn today are only partial plots. (The inline option without interactivity display complete plots).
When I pan, I can see more sections of the image.
I would like to see the entire plot and I am not sure what has caused this change in display
When image is first displayed it appears like this:
Image created upon running the cell
After panning it appears like this:
New section of image displayed upon panning
NOTE: This started to occur after updating to Matplotlib version 3.3.0.
For the current time I have reverted to Matplotlib version 3.1.0. But if the latest has some dependencies that I am missing which is causing the issue, I would like to learn how to figure those out.
I do not receive any errors or warnings upon import matplotlib or pyplot when working with 3.3.0
Related
Trying to use blitting inside a jupyter notebook does not update the figure, only the first image is shown instead of the animation updating the figure.
Blitting as defined in the matplotlib documentation https://matplotlib.org/3.5.0/tutorials/advanced/blitting.html
The notebook can be downloaded from here
Do you know if there is a possibility to make that work ?
I recently updated from matplotlib 1.5.1 to 2.2.3 with
$ pip install -U matplotlib
When showing plotted data with
>>> plt.show()
I could see plots displayed as shown in the attached picture "Output before update" before running the update from 1.5.1 to 2.2.3.
Because I didn't like the new interface of version 2.2.3 when displaying plots I switched back to the old version with
$ pip install matplotlib==1.5.1
Yet I'm still seeing a different interface when I show plots using the old matplotlib version (as you can see in the image "Output after update and return to the old version"), even though I returned to the old version of matplotlib I had used to generate the "Output before update".
You can check what I mean by "interface" when you type in your command line:
$ python
>>> import matplotlib.pyplot as plt
>>> plt.plot()
>>> plt.show()
You'll see the "interface" (in my case IPython) and an empty plot.
My questions are:
How do I display plots with the old output window again ("Output before update", see below)?
And why didn't the return to version 1.5.1 bring the old output window back as well?
Attached you find a comparison between the old output interface that I'd like to get back, and the new output using the same matplotlib version (slightly different data shown, but both plotted in default style, only with colors and markers manually set). The new output is blurry and thick, and the data points are very large as opposed to the old version, which I find much less aesthetic.
Output after update and return to the old version
Output before update
Picture of the "blurry" output window
Interactive matplotlib plotting is already a thing, but does not work properly in Pycharm, when used within a jupyter notebook.
The %matplotlib notebook does not work (throws no error, but I get <IPython ... JavaScript object> instead of a plot. If I plot normally (also with or without plt.show()) I just get a png and cannot interact in any way (even if, e.g., sliders are visible).
I couldn't find any answers elsewhere to this exact problem. It might be working in the browser version of jupyter, but I would like to stick to using PyCharm.
Pycharm v 2017.3 Community Edition
You can try:
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
Instead of importing only the peplos.
It's a trick I found on forum of Jetbrains
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000736584-SciView-in-PyCharm-2017-3-reduces-functionality-of-Matplotlib It works for me. With this, you skip actually the Sciview and plot in a normal matplotlib window
This is not a duplicate as suggested. I am not trying to switch backends. I am just trying to use the %matplotlib notebook formulation. Moreover, the solutions suggested in that other question (place the%matplotlib notebook before the the from matplotlib import pylplot as plt OR trying call the magic command twice in a row) do not work for me. The behavior (blank notebook charts) remains.
place the%matplotlib notebook before the the from matplotlib import pylplot as plt OR trying call the magic command twice in a row
When I use %matplotlib inline my charts always show, but they're generally on the small side, and have no ability to zoom/pan.
When I use %matplotlib notebook I get zoomable, pannable charts, but I sometimes encounter problems where the charts display as blank.
Background:
PythonAnywhere notebook 3.6 Python. Using update Google Chrome from Windows 7.
If I reopen my existing notebook, even restart the kernel and re-run all the cells, all my .plot() appear blank. But if I contemporaneously start a brand new 3.6 notebook, %matplotlib notebook plots work fine. Killing all the jupyter-related processes doesn't help either.
This does not always occur. But if one chart appears blank, they all appear blank.
I would like to use the notebook magic, but this problem is pretty profound.
I have found some stability on using %matplotlib notebook, after including plt.close(), before all my plots.
A pretty dirty solution, I know, but it's working. Here Windows 10, Python 3.6.2 and Jupyter 6.03 (updated Jupyter haven't solved the issue).
Hope this helps.
%matplotlib qt will do your job.
I'm trying to come up to speed on the animation functionality in pyplot. I've grabbed the example code given here: https://matplotlib.org/2.0.0/examples/animation/animate_decay.html
and I'm attempting to run it myself. The result I get is empty axes with no animation at all. My setup is anaconda 4.3, with python 3.6. Matplotlib is version 2.0.0, and I'm running this in a jupyter notebook. I've tried IE 11, Chrome 59 and Firefox 54 on both a windows 7 machine and a Mac.
If you're using Spyder, you need to change your Matplotlib backend by going to the menu
Tools > Preferences > IPython console > Graphics
and then selecting Automatic in the section called Graphics backend. After that, you need to restart Spyder or the kernel associated with the console you want this change to take effect on.
A jupyter notebook would probably use the inline backend by default which cannot be animated (since it produces png images).
You may use the notebook backend to have the plot produced in an interactive notebook cell,
%matplotlib notebook
or the Tk backend to get a new window with the animation popping up,
%matplotlib tk
If using matplotlib 2.1, you may also use the %matplotlib inline backend and show the animation as JavaScript,
from IPython.display import HTML
HTML(ani.to_jshtml())