SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S


1
(9)
2
(6)
3
(8)
4
(6)
5
6
(1)
7
(4)
8
(15)
9
(11)
10
11
(1)
12
(13)
13
(5)
14
(10)
15
(12)
16
(7)
17
(12)
18
(5)
19
(4)
20
(11)
21
(4)
22
(11)
23
(28)
24
(24)
25
(23)
26
(6)
27
(7)
28
(17)
29
(21)
30
(6)



Showing 13 results of 13

From: Eric F. <ef...@ha...> - 2008年04月12日 23:26:49
In reference to:
http://news.gmane.org/find-root.php?message_id=%3cc7009a550804100055g6388b20ej520e85d8e679a55%40mail.gmail.com%3e
A point was brought up that deserves wider dissemination and a 
correction, hence my posting to two lists.
To reduce confusion among new users and to improve code readability, 
participants in a numpy sprint, including John D. Hunter (remotely), 
agreed to promote the following standard:
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
This differs from the message referenced above in that the standard 
entrance point for the plotting functionality of pylab is the pyplot 
module of matplotlib, not the pylab module. Pyplot is a fairly recent 
addition that provides the state-machine plotting interface; pylab is 
essentially the result of dumping pyplot and numpy into a single 
namespace, which is sometimes convenient for interactive use but 
certainly is not encouraged for programming.
The recommended standard is intended to promote consistency and 
readability in the numpy, scipy, and matplotlib families of modules, and 
in their documentation; it is not intended to imply any restriction on 
the user's freedom. The recommendation may be helpful in your own code, 
or it may not; use it where it helps.
This message is intended to be informational; it is not a trial balloon, 
and it is not intended to stimulate discussion. I hope the related 
discussions that have already occurred on the numpy and matplotlib lists 
will suffice.
Eric
From: Eric F. <ef...@ha...> - 2008年04月12日 18:54:46
Alan G Isaac wrote:
> On 2008年4月11日, Eric Firing apparently wrote:
>> It sounds like what you want is a listed colormap with direct indexing 
>> using a NoNorm() instance as the norm:
> 
>> cmap = mpl.colors.ListedColormap(['k', 'r', 'b'])
>> norm = mpl.colors.NoNorm()
>> matshow(aa, cmap=cmap, norm=norm, interpolation='nearest')
> 
> Perfect!
> 
> I actually had found ListedColormap in the docs.
> It's name was very promising but the __init__ function had 
> no help. Can I suggest adding at least the following:
> 
> `colors` is a sequence of Matplotlib colors.
> `name` is a string (a name assigned to this colormap).
Good point. I have added a docstring. In the process I did a little 
checking, found a bug (only for the odd case where N is specified and is 
less than the length of the list of colors), and fixed it.
> 
> Seems obvious in retrospect, but of course that's too late ...
> 
> By the way, how is the name attribute used?
I'm not sure whether it is actually being used by anyone, but having a 
name attribute for each colormap could make it easier manage a set of 
colormaps.
Eric
> 
> Thanks,
> Alan
From: Gideon S. <gr...@co...> - 2008年04月12日 18:41:45
For some reason when trying to save in PNG format on OS X 10.5.2, a 
window pops up with the error:
Matplotlib backend_wx error
cannot return std::string from Unicode object
This is with the simple scipy demo at http://www.scipy.org/Cookbook/OptimizationDemo1
Gideon Simpson
Department of Applied Physics & Applied Mathematics
Columbia University
gr...@co...
From: Alan G I. <ai...@am...> - 2008年04月12日 17:37:21
Attachments: anim.py
On 2008年4月12日, Alan G Isaac apparently wrote:
> 1. Running anim.py at DOS prompt: it runs correctly until 
> the end:
> Fatal Python error: PyEval_RestoreThread: NULL tstate
OK, there is a simple fix to this:
explicitly close the figure after the loop.
I'll attach a fixed example file, in case
a developer cares to substitute it.
New question 1: why is this necessary?
New question 2: why can I tab away from the Tk Window
while this script is running but not tab back to it?
Old question remaining:
Running under the Python interpreter (using execfile): The 
Tk window will not display until the script has finished 
running, so the animation cannot be viewed. How can I run 
this animation from the interpreter window? 
Note that this seems closely related to New Question 2.
Thank you,
Alan Isaac
From: Alan G I. <ai...@am...> - 2008年04月12日 17:37:14
On 2008年4月11日, Eric Firing apparently wrote:
> It sounds like what you want is a listed colormap with direct indexing 
> using a NoNorm() instance as the norm:
> cmap = mpl.colors.ListedColormap(['k', 'r', 'b'])
> norm = mpl.colors.NoNorm()
> matshow(aa, cmap=cmap, norm=norm, interpolation='nearest')
Perfect!
I actually had found ListedColormap in the docs.
It's name was very promising but the __init__ function had 
no help. Can I suggest adding at least the following:
 `colors` is a sequence of Matplotlib colors.
 `name` is a string (a name assigned to this colormap).
Seems obvious in retrospect, but of course that's too late ...
By the way, how is the name attribute used?
Thanks,
Alan
From: Norbert N. <Nor...@gm...> - 2008年04月12日 16:36:16
Thanks! Perfect! I *love* matplotlib!!!
Darren Dale wrote:
> On Saturday 12 April 2008 7:19:32 am Norbert Nemec wrote:
> 
>> Hi there,
>>
>> I often have the case that I want to view different data sets that share
>> one axis. Imagine, for example, a time series of several different
>> observables. Since all observables may have different units, scales and
>> offsets, I would want to display them as separate subplots that have the
>> same x-axis (time) but indepent y scales.
>>
>> Is there a way to lock the scales of several subplots so that when I
>> zoom into one of the subplots interactively, the scale of the other
>> subplots is automatically adjusted? (Preferably something simple enough
>> to use it in quick-and-dirty scripts or even interactive sessions.)
>> 
>
> I think shared_axis_demo.py, in the examples archive, is what you are looking 
> for. It is well documented, and simple enough to include here in its 
> entirety:
>
> """
> You can share the x or y axis limits for one axis with another by
> passing an axes instance as a sharex or sharey kwarg.
>
> Changing the axis limits on one axes will be reflected automatically
> in the other, and vice-versa, so when you navigate with the toolbar
> the axes will follow each other on their shared axes. Ditto for
> changes in the axis scaling (eg log vs linear). However, it is
> possible to have differences in tick labeling, eg you can selectively
> turn off the tick labels on one axes.
>
> The example below shows how to customize the tick labels on the
> various axes. Shared axes share the tick locator, tick formatter,
> view limits, and transformation (eg log, linear). But the ticklabels
> themselves do not share properties. This is a feature and not a bug,
> because you may want to make the tick labels smaller on the upper
> axes, eg in the example below.
>
> If you want to turn off the ticklabels for a given axes (eg on
> subplot(211) or subplot(212), you cannot do the standard trick
>
> setp(ax2, xticklabels=[])
>
> because this changes the tick Formatter, which is shared among all
> axes. But you can alter the visibility of the labels, which is a
> property
>
> setp( ax2.get_xticklabels(), visible=False)
>
>
> """
> from pylab import *
>
> t = arange(0.01, 5.0, 0.01)
> s1 = sin(2*pi*t)
> s2 = exp(-t)
> s3 = sin(4*pi*t)
> ax1 = subplot(311)
> plot(t,s1)
> setp( ax1.get_xticklabels(), fontsize=6)
>
> ## share x only
> ax2 = subplot(312, sharex=ax1)
> plot(t, s2)
> # make these tick labels invisible
> setp( ax2.get_xticklabels(), visible=False)
>
> # share x and y
> ax3 = subplot(313, sharex=ax1, sharey=ax1)
> plot(t, s3)
> xlim(0.01,5.0)
> show()
>
>
> Darren
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save 100ドル. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
From: Darren D. <dar...@co...> - 2008年04月12日 12:00:36
On Saturday 12 April 2008 7:19:32 am Norbert Nemec wrote:
> Hi there,
>
> I often have the case that I want to view different data sets that share
> one axis. Imagine, for example, a time series of several different
> observables. Since all observables may have different units, scales and
> offsets, I would want to display them as separate subplots that have the
> same x-axis (time) but indepent y scales.
>
> Is there a way to lock the scales of several subplots so that when I
> zoom into one of the subplots interactively, the scale of the other
> subplots is automatically adjusted? (Preferably something simple enough
> to use it in quick-and-dirty scripts or even interactive sessions.)
I think shared_axis_demo.py, in the examples archive, is what you are looking 
for. It is well documented, and simple enough to include here in its 
entirety:
"""
You can share the x or y axis limits for one axis with another by
passing an axes instance as a sharex or sharey kwarg.
Changing the axis limits on one axes will be reflected automatically
in the other, and vice-versa, so when you navigate with the toolbar
the axes will follow each other on their shared axes. Ditto for
changes in the axis scaling (eg log vs linear). However, it is
possible to have differences in tick labeling, eg you can selectively
turn off the tick labels on one axes.
The example below shows how to customize the tick labels on the
various axes. Shared axes share the tick locator, tick formatter,
view limits, and transformation (eg log, linear). But the ticklabels
themselves do not share properties. This is a feature and not a bug,
because you may want to make the tick labels smaller on the upper
axes, eg in the example below.
If you want to turn off the ticklabels for a given axes (eg on
subplot(211) or subplot(212), you cannot do the standard trick
 setp(ax2, xticklabels=[])
because this changes the tick Formatter, which is shared among all
axes. But you can alter the visibility of the labels, which is a
property
 setp( ax2.get_xticklabels(), visible=False)
"""
from pylab import *
t = arange(0.01, 5.0, 0.01)
s1 = sin(2*pi*t)
s2 = exp(-t)
s3 = sin(4*pi*t)
ax1 = subplot(311)
plot(t,s1)
setp( ax1.get_xticklabels(), fontsize=6)
## share x only
ax2 = subplot(312, sharex=ax1)
plot(t, s2)
# make these tick labels invisible
setp( ax2.get_xticklabels(), visible=False)
# share x and y
ax3 = subplot(313, sharex=ax1, sharey=ax1)
plot(t, s3)
xlim(0.01,5.0)
show()
Darren
From: Norbert N. <Nor...@gm...> - 2008年04月12日 11:19:46
Hi there,
I often have the case that I want to view different data sets that share 
one axis. Imagine, for example, a time series of several different 
observables. Since all observables may have different units, scales and 
offsets, I would want to display them as separate subplots that have the 
same x-axis (time) but indepent y scales.
Is there a way to lock the scales of several subplots so that when I 
zoom into one of the subplots interactively, the scale of the other 
subplots is automatically adjusted? (Preferably something simple enough 
to use it in quick-and-dirty scripts or even interactive sessions.)
Thanks for your help!
Greetings,
Norbert Nemec
From: sa6113 <s.p...@gm...> - 2008年04月12日 08:21:07
what options we have for performing ssh (actually scp) on Windows and Linux
from Python.
Note that Linux has builtin ssh/scp, hence, pexpect should be a simple
option, but to the best
of my knowledge Windows does not anything. I would like to see a list of
options on this. 
Would you please help me ?
-- 
View this message in context: http://www.nabble.com/ssh-options-tp16646647p16646647.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2008年04月12日 06:50:42
Alan,
It sounds like what you want is a listed colormap with direct indexing 
using a NoNorm() instance as the norm:
aa = ones((2,3), dtype=int)
aa[0,0] = 0
aa[:,2] = 2
cmap = mpl.colors.ListedColormap(['k', 'r', 'b'])
norm = mpl.colors.NoNorm()
matshow(aa, cmap=cmap, norm=norm, interpolation='nearest')
The array has to be one of the integer dtypes.
Also see examples/colorbar_only.py if you want to use a colorbar--but I 
suspect you won't for your present application.
Eric
Alan G Isaac wrote:
> I have an integer array.
> The number of different integers is small,
> so small that I would like to define an
> integer to color mapping and use this
> with matshow. E.g.,
> 0 -> black
> 1 -> red
> 2 -> blue
> etc
> 
> Possible?
> 
> Thank you,
> Alan Isaac
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save 100ドル. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Alan G I. <ai...@am...> - 2008年04月12日 06:21:54
I have an integer array.
The number of different integers is small,
so small that I would like to define an
integer to color mapping and use this
with matshow. E.g.,
0 -> black
1 -> red
2 -> blue
etc
Possible?
Thank you,
Alan Isaac
From: Alan G I. <ai...@am...> - 2008年04月12日 05:16:09
I have a couple questions about anim.py:
http://matplotlib.sourceforge.net/examples/anim.py
I'm running Python 2.5.1 and Matplotlib 0.90.1 under Win 2000.
1. Running anim.py at DOS prompt: it runs correctly until 
the end:
 Fatal Python error: PyEval_RestoreThread: NULL tstate
 This application has requested the Runtime to terminate it in an unusual way.
 Please contact the application's support team for more information.
How can I get rid of this error?
2. Running under the Python interpreter (using execfile):
The Tk window will not display until the script has finished 
running, so the animation cannot be viewed. How can I run
this animation from the interpreter window?
Thank you,
Alan Isaac
From: cr b. <cr...@ya...> - 2008年04月12日 02:42:54
Hello, 
I wish to plot 4 different raster images within a figure, and later
plot registered lines highlighting certain features of them.
Here is the code to read one image and plot it, works as expcted:
img = Image.open(sys.argv[1])
img1 = numpy.asarray(img)
pylab.figure()
pylab.imshow(img1)
pylab.savefig('_imgok.jpg')
Now, make a double-sized image array, and tile the original image into it:
pylab.figure()
YRES = img1.shape[0]
XRES = img1.shape[1]
twoimg = numpy.zeros((2*YRES,2*XRES,3))
#twoimg = numpy.empty((2*YRES,2*XRES,3),numpy.uint32)
twoimg[0:YRES,0:XRES,:] = img1
twoimg[0:YRES,XRES:2*XRES,:] = img1
twoimg[YRES:2*YRES,0:XRES,:] = img1
pylab.imshow(twoimg, origin='upper', interpolation='nearest')
pylab.gray()
pylab.savefig('_imgproblem.jpg')
It comes out strangely colored, vaguely as if the red and green channels were
swapped. However, that's not it (I tried swapping).
This is with maaplib-0.91 (-2?) on a mac 10.4.11, and I think
the backend is GTKAgg
Thanks for any advice 
(recent convert from matlab, quite happy...)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Showing 13 results of 13

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /