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
(16)
2
(31)
3
(17)
4
(18)
5
(7)
6
(5)
7
(16)
8
(9)
9
(19)
10
(18)
11
(17)
12
(7)
13
(6)
14
(15)
15
(16)
16
(15)
17
(19)
18
(27)
19
(10)
20
(5)
21
(5)
22
(19)
23
(7)
24
(11)
25
(19)
26
(1)
27
(36)
28
(37)
29
(28)
30
(36)



Showing results of 480

<< < 1 .. 4 5 6 7 8 .. 20 > >> (Page 6 of 20)
From: Gökhan S. <gok...@gm...> - 2009年09月27日 02:23:21
First the first part, my understanding is if twiny() could accept tranforms
this like twin() this issued might be resolved. When I use twin() and
transforms with different scaled data sources, I can't get one of them being
plotted correctly.
Just FYI,
Maybe someone can further look into this.
Thank you.
On Fri, Sep 25, 2009 at 11:45 AM, Gökhan Sever <gok...@gm...>wrote:
>
>
> On Fri, Sep 25, 2009 at 6:52 AM, John Hunter <jd...@gm...> wrote:
>
>> On Thu, Sep 24, 2009 at 3:29 PM, Gökhan Sever <gok...@gm...>
>> wrote:
>> > Hello,
>> >
>> > One easy one harder two questions :)
>> >
>> > My screenshot http://img213.imageshack.us/img213/3443/snapshot5.png
>> >
>> > 1-) I want to link bottom and top x axes as well as left and right y
>> axes.
>> > For now on the x-axis xticks are the time in seconds from midnight, not
>> sure
>> > how to add the secondary top x axis with time in regular HH:MM:SS
>> > representation, without plotting the same data again. Right y-axis is
>> there
>> > thanks to twinx however that and left one don't snap each other when I
>> zoom
>> > in the plot. There is the twin function but couldn't figure out how to
>> > achieve what I explained here.
>> >
>>
>> You might be able to manually add text for the upper tick labels, as
>> in this example:
>>
>>
>> http://matplotlib.sourceforge.net/examples/pylab_examples/boxplot_demo2.html
>>
>> JDH
>>
>
> Hi John,
>
> Allright, previously I was blocking the plotting event while trying to
> update ticks instead of ticklabels. Hah trying to use 8103 ticks kills the
> action :)
>
> After looking at that example I brought parx = host.twiny() into the game.
>
> Now when I do parx.xaxis.set_ticklabels(dccn.hms) I only get 5 wrong
> ticklabels. If I do a simple plot(dccn.hms) ticklabels are properly set. I
> know a few additional steps needed to make this work, but couldn't manage to
> solve this yet.
>
> On your suggested example try zooming into the plot, bottom and top x-axes
> behave differently. JJ suggested to use xlim_changed and ylim_changed event
> connection but how ? :)
>
> One more question;
>
> Say simply when I do: parx.xaxis.set_ticks(arange(10)), and later query:
>
> I[30]: parx.xaxis.get_majorticklocs()
> O[30]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>
> whereas
>
> I[31]: parx.xaxis.get_majorticklabels()
> O[31]: <a list of 10 Text major ticklabel objects>
>
> I get objects here. Is there a way to see their actual values, besides the
> object representation like in get_majorticklocs() method?
>
> Thank you.
>
> --
> Gökhan
>
-- 
Gökhan
From: Ryan M. <rm...@gm...> - 2009年09月27日 02:17:54
On Sat, Sep 26, 2009 at 8:27 PM, Dr. Phillip M. Feldman
<pfe...@ve...> wrote:
>
> When I try to import register_cmap from matplotlib, matplotlib.colors, or any
> of the other likely candidate modules in which it might be contained, I get
> a "cannot import" error. It would be great if the documentation indicated
> how to import this and provided at least one working example.
We do. plt.register_cmap works for me with SVN HEAD and it looks
like it's present in 0.99. You probably just have an older version,
as register_cmap is a recent addition. What version of matplotlib do
you have installed?
python -c 'import matplotlib;print matplotlib.__version__'
Try updating. That should fix it.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Jae-Joon L. <lee...@gm...> - 2009年09月27日 02:09:54
It seems that you're using an older version of matplotlib.
register_cmap is available in the current version of mpl, which is
0.99.1. And the example works fine.
While it is best if the documentation states which functionality
became available at which version, unfortunately it is not. If you
want to contribute, it is always welcomed.
-JJ
On Sat, Sep 26, 2009 at 9:27 PM, Dr. Phillip M. Feldman
<pfe...@ve...> wrote:
>
> When I try to import register_cmap from matplotlib, matplotlib.colors, or any
> of the other likely candidate modules in which it might be contained, I get
> a "cannot import" error. It would be great if the documentation indicated
> how to import this and provided at least one working example.
> --
> View this message in context: http://www.nabble.com/where-does-register_cmap-come-from--tp25630125p25630125.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Dr. P. M. F. <pfe...@ve...> - 2009年09月27日 01:27:43
When I try to import register_cmap from matplotlib, matplotlib.colors, or any
of the other likely candidate modules in which it might be contained, I get
a "cannot import" error. It would be great if the documentation indicated
how to import this and provided at least one working example.
-- 
View this message in context: http://www.nabble.com/where-does-register_cmap-come-from--tp25630125p25630125.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Dr. P. M. F. <pfe...@ve...> - 2009年09月27日 00:59:01
When I try to access that Wiki, I get the following message: This page does
not exist yet.
<snip>
Check this wiki item and the associated mailing list thread:
http://www.scipy.org/wikis/topical_software/LoadingAColormapDynamically
-- 
View this message in context: http://www.nabble.com/Custom-colormaps-tp881450p25630036.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Dr. P. M. F. <pfe...@ve...> - 2009年09月27日 00:55:16
When I try to run the sample custom colormap code provided at
http://matplotlib.sourceforge.net/examples/pylab_examples/custom_cmap.html ,
I get the following error message:
AttributeError Traceback (most recent call last)
colormaps.py in <module>()
 114
 115 blue_red2 = LinearSegmentedColormap('BlueRed2', cdict2)
--> 116 plt.register_cmap(cmap=blue_red2)
 117
 118 # Third, for LinearSegmentedColormap only,
AttributeError: 'module' object has no attribute 'register_cmap'
WARNING: Failure executing file: <colormaps.py>
-- 
View this message in context: http://www.nabble.com/sample-colormap-code-is-broken-tp25630022p25630022.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Dr. P. M. F. <pfe...@ve...> - 2009年09月26日 21:38:25
I'd like to be able to create and use a custom colormap. I'm creating the
colormap via
the following statement:
matplotlib.colors.ListedColormap([(0,0,0),(0.6,0,0),(0,0.6,0),(0.6,0.6,0)],
 name='Earth')
The above statement appears to work, but when I attempt to use this
colormap, I
get the error shown below. Any suggestions will be appreciated.
AssertionError Traceback (most recent call last)
art.py in <module>()
 253
 254 # Plot z as image using specified color map:
--> 255 pyplot.imshow(z, origin='lower', cmap=get_cmap(map_names[n_map-1]),
 256 extent=[x.min(),x.max(),y.min(),y.max()])
 257
C:\Program
Files\Python25\lib\site-packages\matplotlib-0.98.5.2n2-py2.5-win32.egg\matplotlib\cm.pyc
in get_cmap(name, lut)
 19 if lut is None: lut = mpl.rcParams['image.lut']
 20
---> 21 assert(name in datad.keys())
 22 return colors.LinearSegmentedColormap(name, datad[name], lut)
 23
AssertionError:
-- 
View this message in context: http://www.nabble.com/can%27t-use-custom-color-maps-tp25629072p25629072.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jonathan T. <jto...@gm...> - 2009年09月25日 21:29:33
You're right! I almost forgot that I had installed a local copy of
matplotlib a long time ago. It looks like Python was finding that
copy before it found the "correct" one. The example appears to work
now.
Thanks again,
-Jon
On Fri, Sep 25, 2009 at 2:14 PM, Jeff Whitaker <js...@fa...> wrote:
> Jonathan Tomshine wrote:
>>
>> I'm quite new to python, but am attempting to add basic plotting
>> functionality to a tk-based GUI application that is run primarily on a
>> Mac. My initial attempts at simply calling "plot" or "errorbar" from
>> within the application resulted in erratic behavior on Python
>> installed through macports on my machine with OSX 10.5 (the plot
>> appears, but the window is unresponsive), or no plot whatsoever (on a
>> friend's Mac with OSX 10.6 and Python, Numpy, and Matplotlib installed
>> through their "official" .dmg packages). All versions are current
>> (Python 2.6.2, Matplotlib 0.99.1.1).
>>
>> When looking at the matplotlib website, I attempted to run the
>> following examples:
>>
>>
>> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk.py
>>
>> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk2.py
>>
>> ...but these fail on my machine (OSX 10.5):
>> ----------
>>
>> udp009069uds:fret_analysis jshine$ python embedding_in_tk.py
>> Traceback (most recent call last):
>> File "embedding_in_tk.py", line 6, in <module>
>>  from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
>> NavigationToolbar2TkAgg
>> File
>> "/Users/jshine/Documents/root/matplotlib/lib/python/matplotlib/backends/backend_tkagg.py",
>> line 8, in <module>
>>  import tkagg         # Paint image to Tk photo blitter
>> extension
>> File
>> "/Users/jshine/Documents/root/matplotlib/lib/python/matplotlib/backends/tkagg.py",
>> line 1, in <module>
>>  import _tkagg
>> ImportError: No module named _tkagg
>> udp009069uds:fret_analysis jshine$
>>
>
> Jonathan: You say you're using macports matplotlib, but that traceback does
> not point to a macports directory (which should be in /opt/local). Perhaps
> you have PYTHONPATH set so you're picking up a local installation of
> matplotlib, which was not built with tkagg support?
>
> -Jeff
>>
>> ----------
>>
>> For those familiar with macports, I did install it with the "tkinter"
>> option enabled:
>>
>> ----------
>>
>> dp009069uds:fret_analysis jshine$ port info py26-matplotlib
>> py26-matplotlib @0.99.1.1 (python, graphics, math)
>> Variants:       cairo, darwin_8, ghostscript, gtk2, latex, qt4,
>> [+]tkinter, wxpython
>>
>> Description:     Matplotlib is a pure python plotting library
>> with the goal of making publication quality plots using a syntax
>> familiar to matlab
>>           users. The library uses numpy for handling large
>> data sets and supports a variety of output backends. This port
>> provides variants for
>>           the different GUIs (gtk2, tkinter, wxpython).
>> Homepage:       http://matplotlib.sourceforge.net
>>
>> Library Dependencies: python26, freetype, libpng, py26-dateutil,
>> py26-tz, py26-numpy, py26-configobj, py26-pyobjc2, py26-pyobjc2-cocoa
>> Platforms:      darwin
>> License:       unknown
>> Maintainers:     ra...@ma..., ope...@ma...
>> udp009069uds:fret_analysis jshine$
>>
>> ----------
>>
>> ...so at this point, I'm pretty much stuck -- my own application
>> doesn't work, and I don't have a working example to follow. I'd
>> greatly appreciate any pointers!
>>
>> Thanks,
>> Jon
>>
>>
>
>
> --
> Jeffrey S. Whitaker     Phone : (303)497-6313
> Meteorologist        FAX  : (303)497-6449
> NOAA/OAR/PSD R/PSD1    Email : Jef...@no...
> 325 Broadway        Office : Skaggs Research Cntr 1D-113
> Boulder, CO, USA 80303-3328 Web  : http://tinyurl.com/5telg
>
>
-- 
Jonathan Tomshine, PhD
University of California, San Francisco
Genentech Hall
600 16th St.
San Francisco, CA 94158-2140
jto...@gm...
From: Jeff W. <js...@fa...> - 2009年09月25日 21:14:13
Jonathan Tomshine wrote:
> I'm quite new to python, but am attempting to add basic plotting
> functionality to a tk-based GUI application that is run primarily on a
> Mac. My initial attempts at simply calling "plot" or "errorbar" from
> within the application resulted in erratic behavior on Python
> installed through macports on my machine with OSX 10.5 (the plot
> appears, but the window is unresponsive), or no plot whatsoever (on a
> friend's Mac with OSX 10.6 and Python, Numpy, and Matplotlib installed
> through their "official" .dmg packages). All versions are current
> (Python 2.6.2, Matplotlib 0.99.1.1).
>
> When looking at the matplotlib website, I attempted to run the
> following examples:
>
> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk.py
> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk2.py
>
> ...but these fail on my machine (OSX 10.5):
> 
> ----------
>
> udp009069uds:fret_analysis jshine$ python embedding_in_tk.py
> Traceback (most recent call last):
> File "embedding_in_tk.py", line 6, in <module>
> from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
> NavigationToolbar2TkAgg
> File "/Users/jshine/Documents/root/matplotlib/lib/python/matplotlib/backends/backend_tkagg.py",
> line 8, in <module>
> import tkagg # Paint image to Tk photo blitter extension
> File "/Users/jshine/Documents/root/matplotlib/lib/python/matplotlib/backends/tkagg.py",
> line 1, in <module>
> import _tkagg
> ImportError: No module named _tkagg
> udp009069uds:fret_analysis jshine$
> 
Jonathan: You say you're using macports matplotlib, but that traceback 
does not point to a macports directory (which should be in /opt/local). 
Perhaps you have PYTHONPATH set so you're picking up a local 
installation of matplotlib, which was not built with tkagg support?
-Jeff
> ----------
>
> For those familiar with macports, I did install it with the "tkinter"
> option enabled:
>
> ----------
>
> dp009069uds:fret_analysis jshine$ port info py26-matplotlib
> py26-matplotlib @0.99.1.1 (python, graphics, math)
> Variants: cairo, darwin_8, ghostscript, gtk2, latex, qt4,
> [+]tkinter, wxpython
>
> Description: Matplotlib is a pure python plotting library
> with the goal of making publication quality plots using a syntax
> familiar to matlab
> users. The library uses numpy for handling large
> data sets and supports a variety of output backends. This port
> provides variants for
> the different GUIs (gtk2, tkinter, wxpython).
> Homepage: http://matplotlib.sourceforge.net
>
> Library Dependencies: python26, freetype, libpng, py26-dateutil,
> py26-tz, py26-numpy, py26-configobj, py26-pyobjc2, py26-pyobjc2-cocoa
> Platforms: darwin
> License: unknown
> Maintainers: ra...@ma..., ope...@ma...
> udp009069uds:fret_analysis jshine$
>
> ----------
>
> ...so at this point, I'm pretty much stuck -- my own application
> doesn't work, and I don't have a working example to follow. I'd
> greatly appreciate any pointers!
>
> Thanks,
> Jon
>
> 
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Jonathan T. <jto...@gm...> - 2009年09月25日 20:42:30
I'm quite new to python, but am attempting to add basic plotting
functionality to a tk-based GUI application that is run primarily on a
Mac. My initial attempts at simply calling "plot" or "errorbar" from
within the application resulted in erratic behavior on Python
installed through macports on my machine with OSX 10.5 (the plot
appears, but the window is unresponsive), or no plot whatsoever (on a
friend's Mac with OSX 10.6 and Python, Numpy, and Matplotlib installed
through their "official" .dmg packages). All versions are current
(Python 2.6.2, Matplotlib 0.99.1.1).
When looking at the matplotlib website, I attempted to run the
following examples:
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk.py
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk2.py
...but these fail on my machine (OSX 10.5):
----------
udp009069uds:fret_analysis jshine$ python embedding_in_tk.py
Traceback (most recent call last):
 File "embedding_in_tk.py", line 6, in <module>
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
NavigationToolbar2TkAgg
 File "/Users/jshine/Documents/root/matplotlib/lib/python/matplotlib/backends/backend_tkagg.py",
line 8, in <module>
 import tkagg # Paint image to Tk photo blitter extension
 File "/Users/jshine/Documents/root/matplotlib/lib/python/matplotlib/backends/tkagg.py",
line 1, in <module>
 import _tkagg
ImportError: No module named _tkagg
udp009069uds:fret_analysis jshine$
----------
For those familiar with macports, I did install it with the "tkinter"
option enabled:
----------
dp009069uds:fret_analysis jshine$ port info py26-matplotlib
py26-matplotlib @0.99.1.1 (python, graphics, math)
Variants: cairo, darwin_8, ghostscript, gtk2, latex, qt4,
[+]tkinter, wxpython
Description: Matplotlib is a pure python plotting library
with the goal of making publication quality plots using a syntax
familiar to matlab
 users. The library uses numpy for handling large
data sets and supports a variety of output backends. This port
provides variants for
 the different GUIs (gtk2, tkinter, wxpython).
Homepage: http://matplotlib.sourceforge.net
Library Dependencies: python26, freetype, libpng, py26-dateutil,
py26-tz, py26-numpy, py26-configobj, py26-pyobjc2, py26-pyobjc2-cocoa
Platforms: darwin
License: unknown
Maintainers: ra...@ma..., ope...@ma...
udp009069uds:fret_analysis jshine$
----------
...so at this point, I'm pretty much stuck -- my own application
doesn't work, and I don't have a working example to follow. I'd
greatly appreciate any pointers!
Thanks,
Jon
-- 
Jonathan Tomshine, PhD
University of California, San Francisco
Genentech Hall
600 16th St.
San Francisco, CA 94158-2140
jto...@gm...
From: Eric F. <ef...@ha...> - 2009年09月25日 18:18:48
Uri Laserson wrote:
> Hi,
> 
> I want to draw a rectangle whose center is at given x,y coords (data
> coords), but whose width is in axes coords. The goal is to rewrite
> boxplot so that if the scaling changes etc, the boxes will stay the
> same width but their x and y positions will adjust accordingly.
> 
> Does anyone have a good idea of how to start implementing this? I
> realized my initial idea of using a blended transform will not work,
> because both x and y positions need to be data coords, while only the
> width needs to be measured in axes coords. Perhaps it's possible to
> specify the width of a rectangle in pixels/points/etc? Any
> suggestions are welcome...
You could use (perhaps subclass) a RegularPolyCollection; collections 
allow one to give positions as offsets using a different transform than 
is used for the collection items.
bar() probably should also be reimplemented using collections.
Eric
> 
> Thanks!
> Uri
> 
From: Christopher B. <Chr...@no...> - 2009年09月25日 17:03:38
Andre Walker-Loud wrote:
>> IPython can remedy all your wonderings :)
I second that!
> What I have in mind is writing code that I can call from a terminal, as 
> opposed to interactively as with iPython.
you can call ipython with a script as a command line parameter:
ipython TheScriptToRun.py
so you can make an alias, or a little shell r batch script that calls 
ipython with your script.
> However, in iPython, can you 
> have a module/script running, and asking me as the user for input?
sure -- either with simple raw_input and friends, or with the GUI 
toolkit of your choice (GTK, wxPython, etc), jsut use the same one as 
you use for MPL.
The key here is that GUI toolkits run a Mainloop() to process user 
input, and once you've started that, they block python until it's done.
What Ipython does is (optionally) start up the GUI toolkit in another 
thread, so that the main interactive prompt is not blocked. It's handy 
for mixing an interactive prompt and GUI stuff, even if you aren't using 
MPL. Plus you get all the other nifty iPython features.
Give it try -- it's wonderful.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Gökhan S. <gok...@gm...> - 2009年09月25日 16:45:26
On Fri, Sep 25, 2009 at 6:52 AM, John Hunter <jd...@gm...> wrote:
> On Thu, Sep 24, 2009 at 3:29 PM, Gökhan Sever <gok...@gm...>
> wrote:
> > Hello,
> >
> > One easy one harder two questions :)
> >
> > My screenshot http://img213.imageshack.us/img213/3443/snapshot5.png
> >
> > 1-) I want to link bottom and top x axes as well as left and right y
> axes.
> > For now on the x-axis xticks are the time in seconds from midnight, not
> sure
> > how to add the secondary top x axis with time in regular HH:MM:SS
> > representation, without plotting the same data again. Right y-axis is
> there
> > thanks to twinx however that and left one don't snap each other when I
> zoom
> > in the plot. There is the twin function but couldn't figure out how to
> > achieve what I explained here.
> >
>
> You might be able to manually add text for the upper tick labels, as
> in this example:
>
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/boxplot_demo2.html
>
> JDH
>
Hi John,
Allright, previously I was blocking the plotting event while trying to
update ticks instead of ticklabels. Hah trying to use 8103 ticks kills the
action :)
After looking at that example I brought parx = host.twiny() into the game.
Now when I do parx.xaxis.set_ticklabels(dccn.hms) I only get 5 wrong
ticklabels. If I do a simple plot(dccn.hms) ticklabels are properly set. I
know a few additional steps needed to make this work, but couldn't manage to
solve this yet.
On your suggested example try zooming into the plot, bottom and top x-axes
behave differently. JJ suggested to use xlim_changed and ylim_changed event
connection but how ? :)
One more question;
Say simply when I do: parx.xaxis.set_ticks(arange(10)), and later query:
I[30]: parx.xaxis.get_majorticklocs()
O[30]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
whereas
I[31]: parx.xaxis.get_majorticklabels()
O[31]: <a list of 10 Text major ticklabel objects>
I get objects here. Is there a way to see their actual values, besides the
object representation like in get_majorticklocs() method?
Thank you.
-- 
Gökhan
From: Uri L. <las...@mi...> - 2009年09月25日 16:22:53
Hi,
I want to draw a rectangle whose center is at given x,y coords (data
coords), but whose width is in axes coords. The goal is to rewrite
boxplot so that if the scaling changes etc, the boxes will stay the
same width but their x and y positions will adjust accordingly.
Does anyone have a good idea of how to start implementing this? I
realized my initial idea of using a blended transform will not work,
because both x and y positions need to be data coords, while only the
width needs to be measured in axes coords. Perhaps it's possible to
specify the width of a rectangle in pixels/points/etc? Any
suggestions are welcome...
Thanks!
Uri
-- 
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
las...@mi...
From: Andre Walker-L. <wal...@gm...> - 2009年09月25日 15:24:29
Hi Gökhan,
Thanks. I will start playing around with iPython.
Andre
On Sep 25, 2009, at 1:22 AM, Gökhan Sever wrote:
>
>
> On Thu, Sep 24, 2009 at 10:47 PM, Andre Walker-Loud <wal...@gm... 
> > wrote:
>> IPython can remedy all your wonderings :)
>>
>> http://matplotlib.sourceforge.net/users/shell.html
>>
>> -- 
>> Gökhan
>
> Hi Gökhan,
>
> I am not very familiar with iPython (I am not opposed to learning 
> either).
>
> What I have in mind is writing code that I can call from a terminal, 
> as opposed to interactively as with iPython. However, in iPython, 
> can you have a module/script running, and asking me as the user for 
> input? I have assumed iPython is similar to an interactive Python 
> interpreter. With the knowledge I have, I can not, while in 
> interactive mode, launch a sub routine that will ask me for input. 
> Is this possible to do (in either Python or iPython)?
>
>
> Thanks,
>
> Andre
>
> Just give it a try (http://ipython.scipy.org/moin/)
>
> I don't think you will ever look back the regular Python 
> interpreter. (When I first start with Python, I only use it for 
> about less than a day :)
>
> This page is very explanatory of what IPython is capable of
> http://ipython.scipy.org/doc/stable/html/overview.html
>
> This is a great audio-visual tutorial about IPython by Jeff Rush
> A Demonstration of the 'IPython' Interactive Shell
>
> and finally I recommend you to watch some of the SciPy09 videos to 
> see how other people using IPython interactively. Since we are 
> corresponding under matplotlib roof, wouldn't be fair it don't 
> suggest you to watch John Hunter's Advanced topics in matplotlib 
> tutorial.
>
From: mdekauwe <mde...@gm...> - 2009年09月25日 14:14:53
Note
palette.set_bad ('w',1.0) # Bad values (i.e., masked, set to white!)
mdekauwe wrote:
> 
> Problem solved thanks to Jose.
> 
> For interest...
> 
> import numpy as np
> import matplotlib.pyplot as plt
> a = np.array([[1,2,3,np.nan,5],[4,22,np.nan,11,9]])
> palette = plt.cm.jet
> palette.set_bad ('w',1.0) # Bad values (i.e., masked, set to grey 0.8
> A = np.ma.array ( a, mask=np.isnan(a))
> plt.imshow(A,interpolation='nearest',cmap=palette)
> plt.show()
> 
> 
> 
> mdekauwe wrote:
>> 
>> Hi,
>> 
>> I am trying to plot a 2D array which contains some NaN values as a map. I
>> would like to be able to control the colours assigned to these data
>> points. At the moment it seems that there are given the same colour as
>> the highest value in the array. Any suggestions would be appreciated.
>> Although not using the basemap I think this example highlights my issue
>> 
>> import numpy as np
>> import matplotlib.pyplot as plt
>> a = np.array([[1,2,3,np.nan,5],[4,22,np.nan,11,9]])
>> plt.imshow(a)
>> plt.show()
>> 
>> as you can hopefully see the NaNs are given the same colours as the
>> highest values in the array. Ideally I would like to give these the
>> colour white, regardless of what colourmap is later applied with basemap.
>> 
>> Many thanks
>> 
>> Martin
>> 
> 
> 
-- 
View this message in context: http://www.nabble.com/Controlling-colours-for-NaN-values-with-basemap-tp25609596p25612897.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: mdekauwe <mde...@gm...> - 2009年09月25日 14:14:13
Problem solved thanks to Jose.
For interest...
import numpy as np
import matplotlib.pyplot as plt
a = np.array([[1,2,3,np.nan,5],[4,22,np.nan,11,9]])
palette = plt.cm.jet
palette.set_bad ('w',1.0) # Bad values (i.e., masked, set to grey 0.8
A = np.ma.array ( a, mask=np.isnan(a))
plt.imshow(A,interpolation='nearest',cmap=palette)
plt.show()
mdekauwe wrote:
> 
> Hi,
> 
> I am trying to plot a 2D array which contains some NaN values as a map. I
> would like to be able to control the colours assigned to these data
> points. At the moment it seems that there are given the same colour as the
> highest value in the array. Any suggestions would be appreciated. Although
> not using the basemap I think this example highlights my issue
> 
> import numpy as np
> import matplotlib.pyplot as plt
> a = np.array([[1,2,3,np.nan,5],[4,22,np.nan,11,9]])
> plt.imshow(a)
> plt.show()
> 
> as you can hopefully see the NaNs are given the same colours as the
> highest values in the array. Ideally I would like to give these the colour
> white, regardless of what colourmap is later applied with basemap.
> 
> Many thanks
> 
> Martin
> 
-- 
View this message in context: http://www.nabble.com/Controlling-colours-for-NaN-values-with-basemap-tp25609596p25612886.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Leopold S. <Leo...@we...> - 2009年09月25日 12:53:26
Hi,
I use a small script to read the elments of a vtk-file and plot them as polygons, 
therefore I create polygons with
 polygon = Polygon(coordinates)
and collect them as patches:
 patches.append(polygon)
afterwards I plot all patches with:
 p = PatchCollection(patches, alpha = 1.0,cmap = mpl.cm.Blues,linewidth="0.0" \
 ,edgecolor="black",linewidth="0.0")
 ax.add_collection(p)
 p.set_clim(vmin=0.0,vmax=1.0)
 p.set_array(np.array(patchColor))
My "stupid" idea was to use linewidth = 0.0 to draw patches with no visible edges. However,
it does not work, there are allways some lines, sometimes they look like artefacts.
Is there some simple solution to draw a patch collection with no edges or to set the edgecolor to the
facecolor? I believe that for single polygons the color = XY comand should work. 
The second question is if it is possible to fill patches with color gradients based on corner values?
Thank you verry much for anny help and suggestions. 
I like matplotlib and I know that it was not developed for the stuff I'm doing,
but I don't like to part with matplotlib since it is such a powerfull tool
Leopold Stadler
(sorry for my broken english, my first mail to an email-list)
______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de
From: John H. <jd...@gm...> - 2009年09月25日 11:52:25
On Thu, Sep 24, 2009 at 3:29 PM, Gökhan Sever <gok...@gm...> wrote:
> Hello,
>
> One easy one harder two questions :)
>
> My screenshot http://img213.imageshack.us/img213/3443/snapshot5.png
>
> 1-) I want to link bottom and top x axes as well as left and right y axes.
> For now on the x-axis xticks are the time in seconds from midnight, not sure
> how to add the secondary top x axis with time in regular HH:MM:SS
> representation, without plotting the same data again. Right y-axis is there
> thanks to twinx however that and left one don't snap each other when I zoom
> in the plot. There is the twin function but couldn't figure out how to
> achieve what I explained here.
>
You might be able to manually add text for the upper tick labels, as
in this example:
http://matplotlib.sourceforge.net/examples/pylab_examples/boxplot_demo2.html
JDH
From: mdekauwe <mde...@gm...> - 2009年09月25日 10:12:03
Hi,
I am trying to plot a 2D array which contains some NaN values as a map. I
would like to be able to control the colours assigned to these data points.
At the moment it seems that there are given the same colour as the highest
value in the array. Any suggestions would be appreciated. Although not using
the basemap I think this example highlights my issue
import numpy as np
import matplotlib.pyplot as plt
a = np.array([[1,2,3,np.nan,5],[4,22,np.nan,11,9]])
plt.imshow(a)
plt.show()
as you can hopefully see the NaNs are given the same colours as the highest
values in the array. Ideally I would like to give these the colour white,
regardless of what colourmap is later applied with basemap.
Many thanks
Martin
-- 
View this message in context: http://www.nabble.com/Controlling-colours-for-NaN-values-with-basemap-tp25609596p25609596.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Gökhan S. <gok...@gm...> - 2009年09月25日 05:23:04
On Thu, Sep 24, 2009 at 10:47 PM, Andre Walker-Loud <wal...@gm...>wrote:
> IPython can remedy all your wonderings :)
>
> http://matplotlib.sourceforge.net/users/shell.html
>
> --
> Gökhan
>
>
> Hi Gökhan,
>
> I am not very familiar with iPython (I am not opposed to learning either).
>
> What I have in mind is writing code that I can call from a terminal, as
> opposed to interactively as with iPython. However, in iPython, can you have
> a module/script running, and asking me as the user for input? I have
> assumed iPython is similar to an interactive Python interpreter. With the
> knowledge I have, I can not, while in interactive mode, launch a sub routine
> that will ask me for input. Is this possible to do (in either Python or
> iPython)?
>
>
> Thanks,
>
> Andre
>
Just give it a try (http://ipython.scipy.org/moin/)
I don't think you will ever look back the regular Python interpreter. (When
I first start with Python, I only use it for about less than a day :)
This page is very explanatory of what IPython is capable of
http://ipython.scipy.org/doc/stable/html/overview.html
This is a great audio-visual tutorial about IPython by Jeff Rush
A Demonstration of the 'IPython' Interactive
Shell<http://video.google.com/videoplay?docid=2025411588241625522>
and finally I recommend you to watch some of the SciPy09 videos to see how
other people using IPython interactively. Since we are corresponding under
matplotlib roof, wouldn't be fair it don't suggest you to watch John
Hunter's Advanced topics in
matplotlib<http://www.archive.org/details/scipy09_advancedTutorialDay1_3>tutorial.
From: Gökhan S. <gok...@gm...> - 2009年09月25日 05:15:08
Thanks Jae-Joon for your explanations.
My second question has easily been solved after setting the label position.
However, I am still stuck snapping the axis pairs. I have two different
scaled data sources. First three data (dccnConc, dccnConAmb, and dccnConSTP
are plotted on the main host y-axis, and dccnSS, and dccnSS_Amb are plotted
on the parasite left y-axis. With twin and proper Affine2D transformation I
could not make the secondary y-axis data being shown on the figure.
The script and the data file I am using is under
http://code.google.com/p/ccnworks/source/browse/#svn/trunk
I execute the script as shown below:
./dccn_plot.py 09_03_26_11_36_15.dmtccnc.combined.raw
Any further thoughts?
On Thu, Sep 24, 2009 at 10:38 PM, Jae-Joon Lee <lee...@gm...> wrote:
> The example below will give you some idea where to start.
> It uses twin function in axes_grid toolkit.
> (also see
> http://matplotlib.sourceforge.net/examples/axes_grid/parasite_simple2.html
> )
>
> You may use twinx or twiny, but you need to make both x and y axis in
> sync to each other (maybe using the "xlim_changed" or "ylim_changed"
> event).
>
> To change the title position you set_position method (the coordinate
> is in normalized axes coordinate). If you need more control, I
> recommend to use annotate function.
>
> Regards,
>
> -JJ
>
> import matplotlib.transforms as mtransforms
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
>
> fig = plt.figure()
>
> ax1 = SubplotHost(fig, 1,1,1)
> fig.add_subplot(ax1)
>
> ax1.plot([41000, 42000, 43000], [10., 60, 80.])
>
> y_max = 90
>
> aux_trans = mtransforms.Affine2D().scale(3600., y_max) # transform
> from ax2 to ax1
>
> ax2 = ax1.twin(aux_trans)
>
> from matplotlib.dates import DateFormatter, HourLocator
> locator = HourLocator()
> ax2.xaxis.set_major_locator(locator)
> formatter = DateFormatter(r'$%H^h$')
> ax2.xaxis.set_major_formatter(formatter)
>
> t = ax1.set_title("Title")
> t.set_position((0.5, 1.05))
>
> plt.show()
>
-- 
Gökhan
From: Andre Walker-L. <wal...@gm...> - 2009年09月25日 03:47:46
> IPython can remedy all your wonderings :)
>
> http://matplotlib.sourceforge.net/users/shell.html
>
> -- 
> Gökhan
Hi Gökhan,
I am not very familiar with iPython (I am not opposed to learning 
either).
What I have in mind is writing code that I can call from a terminal, 
as opposed to interactively as with iPython. However, in iPython, can 
you have a module/script running, and asking me as the user for 
input? I have assumed iPython is similar to an interactive Python 
interpreter. With the knowledge I have, I can not, while in 
interactive mode, launch a sub routine that will ask me for input. Is 
this possible to do (in either Python or iPython)?
Thanks,
Andre
On Sep 24, 2009, at 8:44 PM, Gökhan Sever wrote:
>
>
> On Thu, Sep 24, 2009 at 7:25 PM, Andre Walker-Loud <wal...@gm... 
> > wrote:
> Hi All,
>
> I have what I think is a basic question. I want to have an
> interactive python script/code which uses matplotlib. For example,
> the script first asks what data set to use, then when received, it
> does some analysis routines, and then makes some plots. To launch the
> plot, my I have in my routine
>
> > #!/usr/bin/python (I am not running in interactive mode, rather I
> made an executable script)
> > import matplotlib.pyplot as plt
>
> some analysis stuff
>
> > plt.show()
>
>
> after the plt.show() command, the terminal I run the script from
> becomes unresponsive until I close plot I made. However, I would like
> instead to be able to continue interacting with the program. For
> example, choosing a fitting window based upon the first plot. But I
> don't want to have to close down the plot to do this. So my
> question(s):
>
> 1 - how do I continue to interact with the terminal (and my program
> asking for more imput) after the plt.show() command has been issued?
>
> 2 - is there an alternative command I can use instead of plt.show()
> which does not lock up the terminal?
>
> 3 - is it possible to launch more than one matplotlib plotting window
> with the same interactive python session (executable python script)?
>
>
> I thought perhaps the answer to my question would be to have a sub-
> script executed by my main one which generates the various plots I
> want, where each successive plot requires user input after viewing the
> previous ones.
>
> Any thoughts/advice are appreciated.
>
>
> Thanks,
>
> Andre
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart 
> your
> developing skills, take BlackBerry mobile applications to market and 
> stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register 
> now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> IPython can remedy all your wonderings :)
>
> http://matplotlib.sourceforge.net/users/shell.html
>
> -- 
> Gökhan
From: Jae-Joon L. <lee...@gm...> - 2009年09月25日 03:39:25
The example below will give you some idea where to start.
It uses twin function in axes_grid toolkit.
(also see http://matplotlib.sourceforge.net/examples/axes_grid/parasite_simple2.html)
You may use twinx or twiny, but you need to make both x and y axis in
sync to each other (maybe using the "xlim_changed" or "ylim_changed"
event).
To change the title position you set_position method (the coordinate
is in normalized axes coordinate). If you need more control, I
recommend to use annotate function.
Regards,
-JJ
import matplotlib.transforms as mtransforms
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
fig = plt.figure()
ax1 = SubplotHost(fig, 1,1,1)
fig.add_subplot(ax1)
ax1.plot([41000, 42000, 43000], [10., 60, 80.])
y_max = 90
aux_trans = mtransforms.Affine2D().scale(3600., y_max) # transform
from ax2 to ax1
ax2 = ax1.twin(aux_trans)
from matplotlib.dates import DateFormatter, HourLocator
locator = HourLocator()
ax2.xaxis.set_major_locator(locator)
formatter = DateFormatter(r'$%H^h$')
ax2.xaxis.set_major_formatter(formatter)
t = ax1.set_title("Title")
t.set_position((0.5, 1.05))
plt.show()
From: Gökhan S. <gok...@gm...> - 2009年09月25日 00:45:12
On Thu, Sep 24, 2009 at 7:25 PM, Andre Walker-Loud <wal...@gm...>wrote:
> Hi All,
>
> I have what I think is a basic question. I want to have an
> interactive python script/code which uses matplotlib. For example,
> the script first asks what data set to use, then when received, it
> does some analysis routines, and then makes some plots. To launch the
> plot, my I have in my routine
>
> > #!/usr/bin/python (I am not running in interactive mode, rather I
> made an executable script)
> > import matplotlib.pyplot as plt
>
> some analysis stuff
>
> > plt.show()
>
>
> after the plt.show() command, the terminal I run the script from
> becomes unresponsive until I close plot I made. However, I would like
> instead to be able to continue interacting with the program. For
> example, choosing a fitting window based upon the first plot. But I
> don't want to have to close down the plot to do this. So my
> question(s):
>
> 1 - how do I continue to interact with the terminal (and my program
> asking for more imput) after the plt.show() command has been issued?
>
> 2 - is there an alternative command I can use instead of plt.show()
> which does not lock up the terminal?
>
> 3 - is it possible to launch more than one matplotlib plotting window
> with the same interactive python session (executable python script)?
>
>
> I thought perhaps the answer to my question would be to have a sub-
> script executed by my main one which generates the various plots I
> want, where each successive plot requires user input after viewing the
> previous ones.
>
> Any thoughts/advice are appreciated.
>
>
> Thanks,
>
> Andre
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
IPython can remedy all your wonderings :)
http://matplotlib.sourceforge.net/users/shell.html
-- 
Gökhan
12 messages has been excluded from this view by a project administrator.

Showing results of 480

<< < 1 .. 4 5 6 7 8 .. 20 > >> (Page 6 of 20)
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 によって変換されたページ (->オリジナル) /