Matplotlib-users Digest, Vol 48, Issue 23

Mike,

Wingware is only example that commerciale soft can not solv ethis problem never,

it gets stuck in all tested by me IDE inclusing Komodo,pythonxy,…

is is general problem if Matplotlib even staertd in book as I mentined previoulsy

it is impossible after show() to continue debug in IDE’s for

example wingware or pythonxy as stated in Beginning Python

Visualization - Crafting Visual Transformation Scripts

(2009)

page 187

Note If you’re not using matplotlib interactively in Python, be

sure to call the function show() after all graphs have been

generated, as it enters a user interface main loop that will stop

execution of the rest of your code. The reason behind this

behavior is that matplotlib is designed to be embedded in a GUI as

well.

In Windows, if you’re working from interactive Python, you need

only issue show() once; close the figures (or figures) to return

to the shell. Subsequent plots will be drawn automatically without

issuing show(), and you’ll be able to plot graphs interactively.

but no one IDE uses ipython
Sandy

Personally, I don’t use Wingware, so I don’t know any specifics about

···

using matplotlib in that environment. You could try asking this
question on a Wingware-related mailing list.

Mike

From: matplotlib-users-request@…564…net
Subject: Matplotlib-users Digest, Vol 48, Issue 23
To: matplotlib-users@lists.sourceforge.net
Date: Mon, 17 May 2010 15:06:07 +0000

Send Matplotlib-users mailing list submissions to
matplotlib-users@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
or, via email, send a message with subject or body ‘help’ to
matplotlib-users-request@…1867…s.sourceforge.net

You can reach the person managing the list at
matplotlib-users-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than “Re: Contents of Matplotlib-users digest…”

Today’s Topics:

  1. Re: imshow memory problem (Michael Droettboom)
  2. FW: Matplotlib-users Digest, Vol 48, Issue 19 (Sandy Ydnas)
  3. align title of subplot with ylabel (hettling)
  4. Re: FW: Matplotlib-users Digest, Vol 48, Issue 19
    (Michael Droettboom)

Message: 1
Date: Mon, 17 May 2010 10:47:41 -0400
From: Michael Droettboom <mdroe@…3051…>
Subject: Re: [Matplotlib-users] imshow memory problem
To: Tom?? Farag? <sensej007@…3102…>
Cc: matplotlib-users@lists.sourceforge.net
Message-ID: <4BF1570D.40701@…86…>
Content-Type: text/plain; charset=windows-1252; format=flowed

On Linux, I only see about an extra 24kb being used when the canvas is
added to a window vs. not adding it (i.e. commenting out the
window.add(canvas) line).

In general, here’s the memory usage to be expected from imshow (if it’s
a floating-point, not-rgb(a) array as you have here):

The original data: 4-bytes-per-pixel for float32 or 8-bytes-per-pixel
for float64 (in your example the array is float64).
Intermediate float data: if the original is not float64, then an
intermediate float64 is created (not the case here)
The colorized data: 4-bytes-per-pixel at original array size
The sized data: 4-bytes-per-pixel at the scaled figure size

I hope I’m not forgetting anything, but the point is that to support
high-speed rendering of plots, the memory usage is much greater than the
data itself. If your data is truly large, the usual technique is to
decimate or downsample it before passing it to matplotlib, as you’re not
going to see more data points than pixels on your display anyway.

Mike

Tom?? Farag? wrote:

Hello,
I am writing a GUI using GTK+ library. I have a question about axes class imshow method memory consumtion. If I pass the imshow an array, the resulting memory consuption is approximatelly 46 times greater than the array size. If I do not add the canvas to a window (in a code below), the memory consuption is “only” 8 times greater. Any tips on how to reduce the memory consuption would be very appreciated and any explanation of how much memmory imshow allocates too. Configuration and script are below.

os: Windowx XP
matplotlib version: 0.99.1
downloaded from: sourceforge.net

script:
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
from pylab import rand
import gtk

window = gtk.Window()
window.connect(“destroy”, gtk.main_quit)

figure = Figure(figsize=(8,6), dpi=72)
canvas = FigureCanvasGTKAgg(figure)
axes = figure.add_subplot(111)

window.add(canvas)

axes.imshow(rand(1024,1024))
canvas.draw()
window.show_all()

gtk.main()

verbose-helpful output:
$HOME=C:\Documents and Settings\Sensej
CONFIGDIR=C:\Documents and Settings\Sensej.matplotlib
matplotlib data path C:\Python26\lib\site-packages\matplotlib\mpl-data
loaded rc file C:\Python26\lib\site-packages\matplotlib\mpl-data\matplotlibrc
matplotlib version 0.99.1
verbose.level helpful
interactive is False
units is False
platform is win32
Using fontManager instance from C:\Documents and Settings\Sensej.matplotlib\fontList.cache
backend GTKAgg version 2.12.1
findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium to Bitstream Vera Sans (C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf) with score of 0.000000

Thank you,
Tomas.



Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


Message: 2
Date: Mon, 17 May 2010 19:48:50 +0500
From: Sandy Ydnas <cde3@…2134…>
Subject: [Matplotlib-users] FW: Matplotlib-users Digest, Vol 48, Issue
19
To: matplotlib-users@lists.sourceforge.net
Message-ID: <COL116-W1259C6A5715D58B2A8D16BF2E00@…520…>
Content-Type: text/plain; charset=“koi8-r”

Hello friends,

no body can answer on first obvious question of Matplotlib!!!

Sandy

From: matplotlib-users-request@…1867…s.sourceforge.net
Subject: Matplotlib-users Digest, Vol 48, Issue 19
To: matplotlib-users@lists.sourceforge.net
Date: Thu, 13 May 2010 18:18:52 +0000

Send Matplotlib-users mailing list submissions to
matplotlib-users@…1867…s.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
or, via email, send a message with subject or body ‘help’ to
matplotlib-users-request@…1544…ceforge.net

You can reach the person managing the list at
matplotlib-users-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than “Re: Contents of Matplotlib-users digest…”

Today’s Topics:

  1. debugging process gets stuck with matpltlib after show()
    (Sandy Sandy)

Message: 1
Date: Thu, 13 May 2010 23:18:42 +0500
From: Sandy Sandy <cde3@…2134…>
Subject: [Matplotlib-users] debugging process gets stuck with
matpltlib after show()
To: matplotlib-users@lists.sourceforge.net
Message-ID: <COL116-W25CCFEBC9E60E3970A7475F2FC0@…3104…>
Content-Type: text/plain; charset=“windows-1252”

Hi all,
I am new born in Python ( 1 week old)

Can you pls help to understand the basic concept of
matpltlib interacting with Python

the mutter is:

during debugging the debug processes stacks when fig is created

for example, in code

import matplotlib.pyplot as plt

from pylab import *

x= 23;

y = 111111;

print(23456)

plt.plot(range(10))

plot([1,2,3])

show()

print(11111111)

a=888

it is impossible after show() to continue debug in any IDE for example Wingwar
or pythonxy

as stated in

Beginning Python Visualization - Crafting Visual Transformation Scripts (2009)

page 187

Note If you?re not using matplotlib interactively in Python, be sure

to call the function show() after all

graphs have been generated, as it enters a user interface main loop

that will stop execution of the rest of

your code. The reason behind this behavior is that matplotlib is

designed to be embedded in a GUI as well.

In Windows, if you?re working from interactive Python, you need only

issue show() once; close the figures

(or figures) to return to the shell. Subsequent plots will be drawn

automatically without issuing show(), and

you?ll be able to plot graphs interactively.

I tried the code

with threads

as suggested in

http://matplotlib.sourceforge.net/users/shell.html

code
taken from people
from wingware

http://www.wingware.com/doc/howtos/matplotlib

from threading import Timer

t = Timer(0, show)

t.start()

but still debugging process gets
stuck…

import
matplotlib as mpl

from
pylab import plot,show,close,ion

x
= range(10)

plot(x)

‘show()’

from
threading import Timer

t
= Timer(0, show)

t.start()

‘ion()
the same result with or not’

a
= 1222233

y
= [2, 8, 3, 9, 4]

plot(y)

zz=
12346

print(44444)

Best Regards

Sandy


Hotmail: Trusted email with Microsoft?s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed…





Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

End of Matplotlib-users Digest, Vol 48, Issue 19



Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed…


Message: 3
Date: Mon, 17 May 2010 17:08:17 +0200
From: hettling <hettling@…3062…>
Subject: [Matplotlib-users] align title of subplot with ylabel
To: matplotlib-users@…1220…sts.sourceforge.net
Message-ID: <1274108897.30154.11.camel@…3105…63…>
Content-Type: text/plain; charset=“UTF-8”

Dear all,

I’m struggling with the following problem plotting my data:

I have a figure with two panels next to each other, which I want to
label ‘A’ and ‘B’. I want to left-justify my panel labels, but not to
the box that contains the plot, but to the y-axis label. I played around
with ‘text()’ and ‘title()’, but did not find a good solution except for
giving the coordinates manually to ‘text()’. This would be very
inconvenient though, because I have many different plots on different
scales.
Here is what I tried:

###Code
import scipy
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(121)
plt.plot(scipy.sin(scipy.arange(1,100, 0.001)))
plt.xlabel(‘xlabel’)
plt.ylabel(“ylabel”)
plt.text(0,1,“A”, fontsize=14, transform=ax.transAxes)

ax = fig.add_subplot(122)
plt.plot(scipy.cos(scipy.arange(1,100, 0.001)))
plt.text(0,1,“B”, fontsize=14, transform=ax.transAxes)
plt.xlabel(‘xlabel’)
###End Code

So the texts ‘A’ and ‘B’ should be a little bit higher and more to the
left. The ‘A’ I want to align with the y-axis label of the left plot,
the ‘B’ with the values of the y-axis of the right plot.

I hope my question is clear, I will appreciate any help!

Thanks in advance,

Hannes


Message: 4
Date: Mon, 17 May 2010 11:05:58 -0400
From: Michael Droettboom <mdroe@…86…>
Subject: Re: [Matplotlib-users] FW: Matplotlib-users Digest, Vol 48,
Issue 19
To: Sandy Ydnas <cde3@…2015…134…>
Cc: matplotlib-users@lists.sourceforge.net
Message-ID: <4BF15B56.1090203@…86…>
Content-Type: text/plain; charset=KOI8-R; format=flowed

Personally, I don’t use Wingware, so I don’t know any specifics about
using matplotlib in that environment. You could try asking this
question on a Wingware-related mailing list.

Mike

Sandy Ydnas wrote:

Hello friends,

no body can answer on first obvious question of Matplotlib!!!

Sandy

From: matplotlib-users-request@lists.sourceforge.net
Subject: Matplotlib-users Digest, Vol 48, Issue 19
To: matplotlib-users@lists.sourceforge.net
Date: Thu, 13 May 2010 18:18:52 +0000

Send Matplotlib-users mailing list submissions to
matplotlib-users@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
or, via email, send a message with subject or body ‘help’ to
matplotlib-users-request@lists.sourceforge.net

You can reach the person managing the list at
matplotlib-users-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than “Re: Contents of Matplotlib-users digest…”

Today’s Topics:

  1. debugging process gets stuck with matpltlib after show()
    (Sandy Sandy)

Message: 1
Date: Thu, 13 May 2010 23:18:42 +0500
From: Sandy Sandy <cde3@…2134…>
Subject: [Matplotlib-users] debugging process gets stuck with
matpltlib after show()
To: matplotlib-users@lists.sourceforge.net
Message-ID: <COL116-W25CCFEBC9E60E3970A7475F2FC0@…520…>
Content-Type: text/plain; charset=“windows-1252”

Hi all,
I am new born in Python ( 1 week old)

Can you pls help to understand the basic concept of
matpltlib interacting with Python

the mutter is:

during debugging the debug processes stacks when fig is created

for example, in code

import matplotlib.pyplot as plt

from pylab import *

x= 23;

y = 111111;

print(23456)

plt.plot(range(10))

plot([1,2,3])

show()

print(11111111)

a=888

it is impossible after show() to continue debug in any IDE for
example Wingwar
or pythonxy

as stated in

Beginning Python Visualization - Crafting Visual Transformation
Scripts (2009)

page 187

Note If you?re not using matplotlib interactively in Python, be sure

to call the function show() after all

graphs have been generated, as it enters a user interface main loop

that will stop execution of the rest of

your code. The reason behind this behavior is that matplotlib is

designed to be embedded in a GUI as well.

In Windows, if you?re working from interactive Python, you need only

issue show() once; close the figures

(or figures) to return to the shell. Subsequent plots will be drawn

automatically without issuing show(), and

you?ll be able to plot graphs interactively.

I tried the code

with threads

as suggested in

http://matplotlib.sourceforge.net/users/shell.html

code
taken from people
from wingware

http://www.wingware.com/doc/howtos/matplotlib

from threading import Timer

t = Timer(0, show)

t.start()

but still debugging process gets
stuck…

import
matplotlib as mpl

from
pylab import plot,show,close,ion

x
= range(10)

plot(x)

‘show()’

from
threading import Timer

t
= Timer(0, show)

t.start()

‘ion()
the same result with or not’

a
= 1222233

y
= [2, 8, 3, 9, 4]

plot(y)

zz=
12346

print(44444)

Best Regards

Sandy


Hotmail: Trusted email with Microsoft?s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed…





Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

End of Matplotlib-users Digest, Vol 48, Issue 19



Hotmail: Powerful Free email with security by Microsoft. Get it now.
https://signup.live.com/signup.aspx?id=60969




Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA





Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

End of Matplotlib-users Digest, Vol 48, Issue 23



Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. Sign up now.

Wingware is only example that commerciale soft can not solve this problem
never,

What does

  >>> matplotlib.get_backend()

report? According to http://www.wingware.com/doc/howtos/matplotlib
they are assuming TkAgg. You may also want to read the suggestions at

  http://matplotlib.sourceforge.net/users/shell.html

for advice on how to use matplotlib interactively from the command
shell in an IDE. Basically, you need to make sure your "backend"
corresponds to the GUI and interactive mode is set to True. See also

  http://matplotlib.sourceforge.net/users/customizing.html
  http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend

JDH

http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show

hth,
Alan Isaac

···

On 5/17/2010 11:31 AM, Sandy Ydnas wrote:

it gets stuck in all tested by me IDE inclusing Komodo,pythonxy