RuntimeError Traceback (most recent call last)
----> 1 merged.loc[:,["GDPC1","INDPRO","UNRATE"]].plot()
/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/tools/plotting.pyc in plot_frame(data, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, *_kwds)
2486 yerr=yerr, xerr=xerr,
2487 secondary_y=secondary_y, sort_columns=sort_columns,
-> 2488 *_kwds)
2489
2490
/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/tools/plotting.pyc in _plot(data, x, y, subplots, ax, kind, *_kwds)
2322 plot_obj = klass(data, subplots=subplots, ax=ax, kind=kind, *_kwds)
2323
-> 2324 plot_obj.generate()
2325 plot_obj.draw()
2326 return plot_obj.result
/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/tools/plotting.pyc in generate(self)
911 self._args_adjust()
912 self._compute_plot_data()
--> 913 self._setup_subplots()
914 self._make_plot()
915 self._add_table()
/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/tools/plotting.pyc in _setup_subplots(self)
958 else:
959 if self.ax is None:
--> 960 fig = self.plt.figure(figsize=self.figsize)
961 axes = fig.add_subplot(111)
962 else:
/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/pyplot.pyc in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, *_kwargs)
433 frameon=frameon,
434 FigureClass=FigureClass,
--> 435 *_kwargs)
436
437 if figLabel:
/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in new_figure_manager(num, _args, *_kwargs)
45 FigureClass = kwargs.pop('FigureClass', Figure)
46 thisFig = FigureClass(_args, *_kwargs)
---> 47 return new_figure_manager_given_figure(num, thisFig)
48
49
/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in new_figure_manager_given_figure(num, figure)
52 Create a new figure manager instance for the given figure.
53 """
---> 54 canvas = FigureCanvasQTAgg(figure)
55 return FigureManagerQT(canvas, num)
56
/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in init(self, figure)
70 if DEBUG:
71 print('FigureCanvasQtAgg: ', figure)
---> 72 FigureCanvasQT.init(self, figure)
73 FigureCanvasAgg.init(self, figure)
74 self._drawRect = None
/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.pyc in init(self, figure)
66 if DEBUG:
67 print('FigureCanvasQt qt4: ', figure)
---> 68 _create_qApp()
69
70 # Note different super-calling style to backend_qt5
/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.pyc in _create_qApp()
136 display = os.environ.get('DISPLAY')
137 if display is None or not re.search(':\d', display):
--> 138 raise RuntimeError('Invalid DISPLAY variable')
139
140 qApp = QtWidgets.QApplication([str(" ")])
RuntimeError: Invalid DISPLAY variable
Does the magic %matplotlib inline fix it in the notebook?
thanks! that fixed it!
On Sat, Oct 31, 2015 at 6:34 PM, Peter Parente [email protected]
wrote:
Does the magic %matplotlib inline fix it in the notebook?
—
Reply to this email directly or view it on GitHub
https://github.com/jupyter/docker-stacks/issues/58#issuecomment-152785600
.
really works! thank you! -.-'
where should I run %matplotlib inline?
In bash? or in the py file?
thanks
The latest images should automatically default to the inline matplotlib backend. docker pull to get the latest if you haven't recently.
I face the same problem too despite using
%matplotlib inline #plots it on the notebook itself
The error message for the code is as follows:
RuntimeError Traceback (most recent call last)
----> 1 print plt.plot(test_data['sqft_living'],test_data['price'],'.',test_data['sqft_living'],sqft_model.predict(test_data),'-')
/opt/conda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in plot(_args, *_kwargs)
3145 @_autogen_docstring(Axes.plot)
3146 def plot(_args, *_kwargs):
-> 3147 ax = gca()
3148 # allow callers to override the hold state by passing hold=True|False
3149 washold = ax.ishold()
/opt/conda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in gca(kwargs)
926 matplotlib.figure.Figure.gca : The figure's gca method.
927 """
--> 928 return gcf().gca(kwargs)
929
930 # More ways of creating axes:
/opt/conda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in gcf()
576 return figManager.canvas.figure
577 else:
--> 578 return figure()
579
580
/opt/conda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, *_kwargs)
525 frameon=frameon,
526 FigureClass=FigureClass,
--> 527 *_kwargs)
528
529 if figLabel:
/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in new_figure_manager(num, _args, *_kwargs)
44 FigureClass = kwargs.pop('FigureClass', Figure)
45 thisFig = FigureClass(_args, *_kwargs)
---> 46 return new_figure_manager_given_figure(num, thisFig)
47
48
/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in new_figure_manager_given_figure(num, figure)
51 Create a new figure manager instance for the given figure.
52 """
---> 53 canvas = FigureCanvasQTAgg(figure)
54 return FigureManagerQT(canvas, num)
55
/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in init(self, figure)
74 if DEBUG:
75 print('FigureCanvasQtAgg: ', figure)
---> 76 FigureCanvasQT.init(self, figure)
77 FigureCanvasQTAggBase.init(self, figure)
78 FigureCanvasAgg.init(self, figure)
/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.pyc in init(self, figure)
66 if DEBUG:
67 print('FigureCanvasQt qt4: ', figure)
---> 68 _create_qApp()
69
70 # Note different super-calling style to backend_qt5
/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.pyc in _create_qApp()
136 display = os.environ.get('DISPLAY')
137 if display is None or not re.search(':\d', display):
--> 138 raise RuntimeError('Invalid DISPLAY variable')
139
140 qApp = QtWidgets.QApplication([str(" ")])
RuntimeError: Invalid DISPLAY variable
I am new to programming and I am learning as much as I can through the internet, any help would be much appreciated as this is hindering my progress!
Thanks, it works fine
Most helpful comment
Does the magic
%matplotlib inlinefix it in the notebook?