Discussion:
[Matplotlib-users] no plots showing
Paul Harrison
2015-11-27 11:35:42 UTC
Permalink
Hi guys,

If I do the following, no plot shows:

***@xroa-dt-20:~> python

Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)

[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2

Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. ,
0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10
Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.

Anyone have any ideas? I'm a bit of a matplotlib beginner so any advice is
extremely welcome!

Thanks,

Paul
Jens Nielsen
2015-11-27 11:48:39 UTC
Permalink
plt.show is a function. You are not calling it just displaying it. Try
doing plt.show()

BTW please use the new mailing list at matplotlib-***@python.org

best
Jens
Post by Paul Harrison
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. ,
0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10
Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any advice is
extremely welcome!
Thanks,
Paul
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Christian Alis
2015-11-27 11:49:51 UTC
Permalink
You're missing a pair of parentheses. Without it, you're just referring to
the function itself.

plt.show()
Post by Paul Harrison
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. ,
0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10
Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any advice is
extremely welcome!
Thanks,
Paul
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Paul Harrison
2015-11-27 11:58:22 UTC
Permalink
Apologies, the parentheses must have got missed off when I copied and
pasted the output from my terminal.

Same issue though, I don't get any plots come up. This always used to work,
and works for my colleagues!

Paul
Post by Paul Harrison
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. ,
0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10
Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any advice is
extremely welcome!
Thanks,
Paul
Jens Nielsen
2015-11-27 12:10:44 UTC
Permalink
Sorry but the parentheses have not gone missing in your copy paste. The
line below will only be printed if you don't have any parentheses after the
function. Can you try again and show the output of actually calling
plt.show()?

Best
Jens
Post by Paul Harrison
Apologies, the parentheses must have got missed off when I copied and
pasted the output from my terminal.
Same issue though, I don't get any plots come up. This always used to
work, and works for my colleagues!
Paul
On Fri, Nov 27, 2015 at 11:35 AM, Paul Harrison <
Post by Paul Harrison
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. ,
0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10
Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any advice
is extremely welcome!
Thanks,
Paul
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Paul Harrison
2015-11-27 12:28:40 UTC
Permalink
Here's some output from an ssh -Y to another machine - I also get the same
result working on the console (no plots appearing).

Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)

[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2

Type "help", "copyright", "credits" or "license" for more information.
Post by Jens Nielsen
Post by Paul Harrison
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
Post by Jens Nielsen
Post by Paul Harrison
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. ,
0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10
Patch objects>)
Post by Jens Nielsen
Post by Paul Harrison
plt.show()
Thanks,

Paul
Post by Jens Nielsen
Sorry but the parentheses have not gone missing in your copy paste. The
line below will only be printed if you don't have any parentheses after the
function. Can you try again and show the output of actually calling
plt.show()?
Best
Jens
Post by Paul Harrison
Apologies, the parentheses must have got missed off when I copied and
pasted the output from my terminal.
Same issue though, I don't get any plots come up. This always used to
work, and works for my colleagues!
Paul
On Fri, Nov 27, 2015 at 11:35 AM, Paul Harrison <
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0.
, 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of
10 Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any advice
is extremely welcome!
Thanks,
Paul
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Jens Nielsen
2015-11-27 12:40:55 UTC
Permalink
Can you try to check which backend you are using
Do something like
Post by Paul Harrison
Post by Jens Nielsen
import matplotlib
matplotlib.get_backend()
after your plot. It is possible that your machine is set to use a non
graphical backend

best
Jens
Post by Paul Harrison
Here's some output from an ssh -Y to another machine - I also get the same
result working on the console (no plots appearing).
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Post by Jens Nielsen
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
Post by Jens Nielsen
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. ,
0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10
Patch objects>)
Post by Jens Nielsen
plt.show()
Thanks,
Paul
Post by Jens Nielsen
Sorry but the parentheses have not gone missing in your copy paste. The
line below will only be printed if you don't have any parentheses after the
function. Can you try again and show the output of actually calling
plt.show()?
Best
Jens
Apologies, the parentheses must have got missed off when I copied and
pasted the output from my terminal.
Same issue though, I don't get any plots come up. This always used to
work, and works for my colleagues!
Paul
On Fri, Nov 27, 2015 at 11:35 AM, Paul Harrison <
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0.
, 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of
10 Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any advice
is extremely welcome!
Thanks,
Paul
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Paul Harrison
2015-11-27 14:30:11 UTC
Permalink
Post by Jens Nielsen
Post by Paul Harrison
Post by Jens Nielsen
plt.show()
import matplotlib
matplotlib.get_backend()
'agg'
Post by Jens Nielsen
Can you try to check which backend you are using
Do something like
Post by Paul Harrison
Post by Jens Nielsen
import matplotlib
matplotlib.get_backend()
after your plot. It is possible that your machine is set to use a non
graphical backend
best
Jens
Post by Paul Harrison
Here's some output from an ssh -Y to another machine - I also get the
same result working on the console (no plots appearing).
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Post by Jens Nielsen
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
Post by Jens Nielsen
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. ,
0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10
Patch objects>)
Post by Jens Nielsen
plt.show()
Thanks,
Paul
Post by Jens Nielsen
Sorry but the parentheses have not gone missing in your copy paste. The
line below will only be printed if you don't have any parentheses after the
function. Can you try again and show the output of actually calling
plt.show()?
Best
Jens
Apologies, the parentheses must have got missed off when I copied and
pasted the output from my terminal.
Same issue though, I don't get any plots come up. This always used to
work, and works for my colleagues!
Paul
On Fri, Nov 27, 2015 at 11:35 AM, Paul Harrison <
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0.
, 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of
10 Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any
advice is extremely welcome!
Thanks,
Paul
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Jens Nielsen
2015-11-27 14:38:09 UTC
Permalink
That makes sense. The agg backend is a non graphical backend intended for
saving image output. I don't know why this is the default one on your
system.

if you start your python session with:
```
import matplotlib
matplotlib.use('TkAgg')
...
```

You will select the TkAgg backend which is interactive and normally
installed. I don't know which ones are available on your system but see the
link below for various possibilities that you may try instead. This also
contains information about how the backends are set.
http://matplotlib.org/faq/usage_faq.html#what-is-a-backend

Note that the MPLBACKEND environmental variable was not added until
matplotlib 1.5

best
Jens
Post by Jens Nielsen
Post by Paul Harrison
Post by Jens Nielsen
plt.show()
import matplotlib
matplotlib.get_backend()
'agg'
Post by Jens Nielsen
Can you try to check which backend you are using
Do something like
Post by Paul Harrison
Post by Jens Nielsen
import matplotlib
matplotlib.get_backend()
after your plot. It is possible that your machine is set to use a non
graphical backend
best
Jens
Post by Paul Harrison
Here's some output from an ssh -Y to another machine - I also get the
same result working on the console (no plots appearing).
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Post by Jens Nielsen
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
Post by Jens Nielsen
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0.
, 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of
10 Patch objects>)
Post by Jens Nielsen
plt.show()
Thanks,
Paul
Post by Jens Nielsen
Sorry but the parentheses have not gone missing in your copy paste. The
line below will only be printed if you don't have any parentheses after the
function. Can you try again and show the output of actually calling
plt.show()?
Best
Jens
Apologies, the parentheses must have got missed off when I copied and
pasted the output from my terminal.
Same issue though, I don't get any plots come up. This always used to
work, and works for my colleagues!
Paul
On Fri, Nov 27, 2015 at 11:35 AM, Paul Harrison <
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([
0. , 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list
of 10 Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any
advice is extremely welcome!
Thanks,
Paul
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Paul Harrison
2015-11-28 13:39:17 UTC
Permalink
This all makes sense - thanks so much for your help!

Paul

On 27 Nov 2015, at 14:38, Jens Nielsen <***@gmail.com> wrote:

That makes sense. The agg backend is a non graphical backend intended for saving image output. I don't know why this is the default one on your system.

if you start your python session with:
```
import matplotlib
matplotlib.use('TkAgg')
...
```

You will select the TkAgg backend which is interactive and normally installed. I don't know which ones are available on your system but see the link below for various possibilities that you may try instead. This also contains information about how the backends are set. http://matplotlib.org/faq/usage_faq.html#what-is-a-backend

Note that the MPLBACKEND environmental variable was not added until matplotlib 1.5

best
Jens
Post by Jens Nielsen
Post by Jens Nielsen
plt.show()
import matplotlib
matplotlib.get_backend()
'agg'
Post by Jens Nielsen
Can you try to check which backend you are using
Do something like
Post by Jens Nielsen
import matplotlib
matplotlib.get_backend()
after your plot. It is possible that your machine is set to use a non graphical backend
best
Jens
Here's some output from an ssh -Y to another machine - I also get the same result working on the console (no plots appearing).
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Post by Jens Nielsen
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
Post by Jens Nielsen
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. , 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10 Patch objects>)
Post by Jens Nielsen
plt.show()
Thanks,
Paul
Post by Jens Nielsen
Sorry but the parentheses have not gone missing in your copy paste. The line below will only be printed if you don't have any parentheses after the function. Can you try again and show the output of actually calling plt.show()?
Best
Jens
Apologies, the parentheses must have got missed off when I copied and pasted the output from my terminal.
Same issue though, I don't get any plots come up. This always used to work, and works for my colleagues!
Paul
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. , 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10 Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any advice is extremely welcome!
Thanks,
Paul
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Dominik Klaes
2015-11-27 12:03:04 UTC
Permalink
Are you logged in on another machine? If so, you might be connected via the
'ssh' command and not 'ssh -X'.

Dominik
Post by Paul Harrison
Apologies, the parentheses must have got missed off when I copied and
pasted the output from my terminal.
Same issue though, I don't get any plots come up. This always used to
work, and works for my colleagues!
Paul
On Fri, Nov 27, 2015 at 11:35 AM, Paul Harrison <
Post by Paul Harrison
Hi guys,
Python 2.6.9 (unknown, Apr 7 2015, 08:28:12)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pylab as plt
plt.figure()
<matplotlib.figure.Figure object at 0x16e5310>
plt.hist([1.0,2,0])
(array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 1.]), array([ 0. ,
0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ]), <a list of 10
Patch objects>)
plt.show
<function show at 0x1730b90>
I'm using SUSE Linux Enterprise 11 SP3 64-bit with python-matplotlib
v1.3.1-70.11.
Anyone have any ideas? I'm a bit of a matplotlib beginner so any advice
is extremely welcome!
Thanks,
Paul
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Dominik Klaes
Argelander-Institut fÃŒr Astronomie
Room 2.027a
Auf dem HÃŒgel 71
53121 Bonn

Telefon: 0228/73-5773
E-Mail: ***@astro.uni-bonn.de <***@astro.uni-bonn.de>
Loading...