question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoiding <matplotlib.figure.Figure at ......>

See original GitHub issue

I’m working with IPython notebook on a server over ssh. In order to avoid the error:


Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/holoviews/ipython/display_hooks.py", line 203, in wrapped
    **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/holoviews/ipython/display_hooks.py", line 233, in element_display
    **opts(element, get_plot_size(element, size)))()
  File "/usr/local/lib/python2.7/dist-packages/holoviews/plotting/raster.py", line 34, in __init__
    super(RasterPlot, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/holoviews/plotting/element.py", line 132, in __init__
    uniform=uniform, **dict(params, **plot_opts))
  File "/usr/local/lib/python2.7/dist-packages/holoviews/plotting/plot.py", line 114, in __init__
    self.handles['axis'] = self._init_axis(axis)
  File "/usr/local/lib/python2.7/dist-packages/holoviews/plotting/plot.py", line 248, in _init_axis
    fig = plt.figure()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 435, in figure
    **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt4agg.py", line 47, in new_figure_manager
    return new_figure_manager_given_figure(num, thisFig)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt4agg.py", line 54, in new_figure_manager_given_figure
    canvas = FigureCanvasQTAgg(figure)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt4agg.py", line 72, in __init__
    FigureCanvasQT.__init__(self, figure)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt4.py", line 68, in __init__
    _create_qApp()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5.py", line 138, in _create_qApp
    raise RuntimeError('Invalid DISPLAY variable')
RuntimeError: Invalid DISPLAY variable

One must evaluate

%matplotlib inline

This always results in <matplotlib.figure.Figure at 0x7fb61b7849d0> being under a HoloMap screen shot 2015-05-13 at 19 38 02

Of course normally this won’t be an issue, but I’m using a HoloMap in a IPython presentation that I’m preparing. Would you know a way to get rid of this?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:26 (24 by maintainers)

github_iconTop GitHub Comments

1reaction
philippjfrcommented, May 13, 2015

Yes this one is pretty annoying. We recommend always using the ‘agg’ backend. You can either specify the backend in your matplotlibrc file or do it in the notebook using:

from matplotlib import pyplot as plt
plt.switch_backend('agg')
0reactions
SSZ1commented, Oct 23, 2019

Did this suggestion not fix it?

Yes this one is pretty annoying. We recommend always using the ‘agg’ backend. You can either specify the backend in your matplotlibrc file or do it in the notebook using:

from matplotlib import pyplot as plt
plt.switch_backend('agg')

It helped me.Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Avoiding <matplotlib.figure.Figure at 0xeafea58>
In the IPython console, the best way to make sure figures show up (without explicitly calling plt.show() ) is to use %matplotlib mode....
Read more >
Avoiding <matplotlib.figure.Figure at ......> #68 - GitHub
I'm working with IPython notebook on a server over ssh. In order to avoid the error: Traceback (most recent call last): File ...
Read more >
matplotlib.figure — Matplotlib 3.6.2 documentation
The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations (labels, ticks, etc). Note that layout managers can have ...
Read more >
matplotlib.pyplot.figure — Matplotlib 3.6.2 documentation
The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations (labels, ticks, etc). Note that layout managers can measurably ...
Read more >
matplotlib.figure.Figure — Matplotlib 3.3.4 documentation
Figure (figsize=None, dpi=None, facecolor=None, edgecolor=None, ... Values above 95 should be avoided; 100 disables portions of the JPEG ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found