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
(10) |
2
(3) |
3
(5) |
4
(7) |
5
(18) |
6
(4) |
7
(15) |
8
(7) |
9
(10) |
10
(4) |
11
(18) |
12
(15) |
13
(11) |
14
(11) |
15
(4) |
16
(28) |
17
(17) |
18
(22) |
19
(12) |
20
(19) |
21
(17) |
22
(14) |
23
(4) |
24
(3) |
25
(6) |
26
(8) |
27
(13) |
28
(11) |
29
(21) |
30
(3) |
31
(5) |
|
|
|
|
|
|
>>>>> "Christopher" == Christopher Barker <Chr...@no...> writes: Christopher> This sounds like a job for properties! make Christopher> _transform a property, and code that gets and sets it Christopher> directly should still work. though People that were Christopher> accessing an underscored name directly should expect Christopher> this kind of problem. The matplotlib artist kwarg properties act like python properties or enthought traits, with some advantages and disadvantages over each (mostly disadvantages, alas). We've discussed migrating to one or another over the years, but haven't bitten the bullet. At each point it's easier to extend the exiting implementation than refactor the whole bit; the tyranny of small decisions. Here are some of the pros and cons as I see them of enthought traits vs python properties Pros: * compatibility with the rest of the enthought tool suite * built in observer pattern * automatic UI for wx users * performance is better than python properties last time I looked * matplotlib ships with enthought traits built in Cons: * smaller user base than python properties may imply fewer 3rd party enhancements, less support, etc * we have to maintain our copy of enthought traits to keep it current and building or require an additional dependency I spent some time working on matplotlib rc properties as enthought traits as a precursor to porting matplotlib properties to traits. Here is some example code showing how to define some representative rc properties and construct a matplotlib artist using traits. Because matplotlib ships with enthought traits already, you can run this script with just matplotlib. Unfortunately, we do not ship the ex UI component so you can't test that part. I'm a bit of a traits newbie so there are probably better ways to do what I have done below. import sys, os, re import matplotlib.enthought.traits as traits from matplotlib.cbook import is_string_like from matplotlib.artist import Artist doprint = True flexible_true_trait = traits.Trait( True, { 'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True, 'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False } ) flexible_false_trait = traits.Trait( False, flexible_true_trait ) colors = { 'c' : '#00bfbf', 'b' : '#0000ff', 'g' : '#008000', 'k' : '#000000', 'm' : '#bf00bf', 'r' : '#ff0000', 'w' : '#ffffff', 'y' : '#bfbf00', 'gold' : '#FFD700', 'peachpuff' : '#FFDAB9', 'navajowhite' : '#FFDEAD', } def hex2color(s): "Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple" return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])]) class RGBA(traits.HasTraits): # r,g,b,a in the range 0-1 with default color 0,0,0,1 (black) r = traits.Range(0., 1., 0.) g = traits.Range(0., 1., 0.) b = traits.Range(0., 1., 0.) a = traits.Range(0., 1., 1.) def __init__(self, r=0., g=0., b=0., a=1.): self.r = r self.g = g self.b = b self.a = a def __repr__(self): return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)'%\ (self.r, self.g, self.b, self.a) def tuple_to_rgba(ob, name, val): tup = [float(x) for x in val] if len(tup)==3: r,g,b = tup return RGBA(r,g,b) elif len(tup)==4: r,g,b,a = tup return RGBA(r,g,b,a) else: raise ValueError tuple_to_rgba.info = 'a RGB or RGBA tuple of floats' def hex_to_rgba(ob, name, val): rgx = re.compile('^#[0-9A-Fa-f]{6}$') if not is_string_like(val): raise TypeError if rgx.match(val) is None: raise ValueError r,g,b = hex2color(val) return RGBA(r,g,b,1.0) hex_to_rgba.info = 'a hex color string' def colorname_to_rgba(ob, name, val): hex = colors[val.lower()] r,g,b = hex2color(hex) return RGBA(r,g,b,1.0) colorname_to_rgba.info = 'a named color' def float_to_rgba(ob, name, val): val = float(val) return RGBA(val, val, val, 1.) float_to_rgba.info = 'a grayscale intensity' Color = traits.Trait(RGBA(), float_to_rgba, colorname_to_rgba, RGBA, hex_to_rgba, tuple_to_rgba) def file_exists(ob, name, val): fh = file(val, 'r') return val def path_exists(ob, name, val): os.path.exists(val) linestyles = ('-', '--', '-.', ':', 'steps', 'None') TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4) linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's', '+', 'x', 'd', 'D', '|', '_', 'h', 'H', 'p', '1', '2', '3', '4', TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN, 'None' ) class LineRC(traits.HasTraits): linewidth = traits.Float(0.5) linestyle = traits.Trait(*linestyles) color = Color marker = traits.Trait(*linemarkers) markerfacecolor = Color markeredgecolor = Color markeredgewidth = traits.Float(0.5) markersize = traits.Float(6) antialiased = flexible_true_trait data_clipping = flexible_false_trait class PatchRC(traits.HasTraits): linewidth = traits.Float(1.0) facecolor = Color edgecolor = Color antialiased = flexible_true_trait timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more backends = ('GTKAgg', 'Cairo', 'FltkAgg', 'GD', 'GDK', 'GTK', 'Agg', 'GTKCairo', 'Paint', 'PS', 'SVG', 'Template', 'TkAgg', 'WX') class RC(traits.HasTraits): backend = traits.Trait(*backends) numerix = traits.Trait('Numeric', 'numarray') interactive = flexible_false_trait toolbar = traits.Trait('toolbar2', 'classic', None) timezone = traits.Trait(*timezones) lines = traits.Trait(LineRC()) patch = traits.Trait(PatchRC()) rc = RC() rc.lines.color = 'r' if doprint: print 'RC' rc.print_traits() print 'RC lines' rc.lines.print_traits() print 'RC patches' rc.patch.print_traits() class Patch(Artist, traits.HasTraits): linewidth = traits.Float(0.5) facecolor = Color fc = facecolor edgecolor = Color fill = flexible_true_trait def __init__(self, edgecolor=None, facecolor=None, linewidth=None, antialiased = None, fill=1, **kwargs ): Artist.__init__(self) if edgecolor is None: edgecolor = rc.patch.edgecolor if facecolor is None: facecolor = rc.patch.facecolor if linewidth is None: linewidth = rc.patch.linewidth if antialiased is None: antialiased = rc.patch.antialiased self.edgecolor = edgecolor self.facecolor = facecolor self.linewidth = linewidth self.antialiased = antialiased self.fill = fill p = Patch() p.facecolor = '#bfbf00' p.edgecolor = 'gold' p.facecolor = (1,.5,.5,.25) p.facecolor = 0.25 p.fill = 'f' print 'p.facecolor', type(p.facecolor), p.facecolor print 'p.fill', type(p.fill), p.fill if p.fill_: print 'fill' else: print 'no fill' if doprint: print print 'Patch' p.print_traits() JDH
John, Tom, I don't understand how generation of the identity transform for each Artist instance could possibly be a significant overall slowdown; it should be very fast, and only a small part of the time required to actually do anything useful with an Artist instance. I am wondering whether this could be a problem with the profiler, not a genuine slowdown. Eric John Hunter wrote: >>>>>> "Tom" == Tom Denniston <tom...@al...> writes: > > Tom> I've been profiling some of my code which builds many > Tom> somewhat complex graphs. I've noticed that it spends almost > Tom> all it's time in the __init__ of the artist class. The time > Tom> there is almost entirely spent on calling identity_transform > Tom> which builds a SeperableTransform that does no > Tom> transforming--from what I can tell--which is consistent with > Tom> the name. The identity transform function buid a bunch of > Tom> other objects all of which are the same each time. My > Tom> question is, does it really need to build all these objects > Tom> over and over again. Given that Artist's __init__ is called > Tom> by so many things wouldn't it be better to have some static > Tom> constants to define these default transformation functions? > Tom> Am I missing something subtle or would this be an > Tom> improvement? > > I'm hesitant to make a single (shared) identity transform since > transforms are mutable. But since most objects to not use the > identity_transform but rather a custom one, we can create it > lazily. I've implemented these changes in svn. Each artist (as > before) has a _transform instance but now it defaults to None. Then > in get_transform > > def get_transform(self): > 'return the Transformation instance used by this artist' > if self._transform is None: > self._transform = identity_transform() > return self._transform > > The harder part was modifying all of the derived classes that were > using the _transform attr directly -- all these had to be ported to > use get_transform instead. The changes are documented in API_CHANGES. > > See if it speeds up your code -- it didn't make an appreciable change > to backend_driver. > > Note the artist constructor shouldn't be a bottleneck in your python > script. If it is, you are probably creating lots-o-artists and you > might be able to use a collection instead. Eg, if you are making > hundreds or thousands of calls to plot and creating a comparable > number of Line2D artists, use a LineCollection instead. > > But if you are still experiencing a problem and the changes I made to > svn don't help (eg if you are creating lots of objects that do require > the default identity_transform), you can experiment with using a > single cached identity_transform. Something like > > import matplotlib.artist > > _cached_transform = matplotlib.artist.identity_transform() > def my_identity_transform(): > return _cached_transform > matplotlib.artist.identity_transform = my_identity_transform > > # import the rest of mpl here > > > > Hope this helps... > > JDH > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
John Hunter wrote: > I'm hesitant to make a single (shared) identity transform since > transforms are mutable. Couldn't you make one that was immutable (is that possible in Python)? Or even just have a convention that you don't mutate the identity transform (though it could be way to late for that now!), kind of like how we all no not to assign anything else to the name "None". > The harder part was modifying all of the derived classes that were > using the _transform attr directly -- all these had to be ported to > use get_transform instead. This sounds like a job for properties! make _transform a property, and code that gets and sets it directly should still work. though People that were accessing an underscored name directly should expect this kind of problem. -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...
>>>>> "Eric" == Eric Emsellem <ems...@ob...> writes: Eric> Hi, I am trying to overplot symbols on a region filled (with Eric> pale grey color) between two curves. For some reason the Eric> filled region is always ON TOP of the symbols so that I Eric> don't see them.. Eric> (I wanted to use transparency with alpha, but then it is to Eric> build a postscript figure which does not support Eric> transparency, so this requires me to first plot the filled Eric> region and then overplot the symbols...) Eric> here is an example: Eric> sampVS = arange(0.,1.,0.02) x = concatenate( Eric> (sampVS,sampVS[::-1]) ) alpha1 = 0.98486328 alpha2 = Eric> 1.28486328 y1 = alpha1 * sampVS / sqrt(1.+(alpha1 * Eric> sampVS)**2) y2 = alpha2 * sampVS / sqrt(1.+(alpha2 * Eric> sampVS)**2) y = concatenate( (y1,y2[::-1]) ) p = fill(x, y, Eric> facecolor=(0.9,0.9,0.9)) scatter([0.4],[0.4]) Eric> ==> the symbol is hidden behind the filled region although Eric> it is plotted afterwards... scatter (a PatchCollection) and fill (a Polygon) both have a zorder of 1, which means they are drawn at the bottom of the draw hierarchy. We take all the artists, sort them by zorder, and draw them in order. You should set the zorder of your scatter to be higher than the zorder of your fill. Eg poly = fill(....) col = scatter(...) col.set_zorder( 1.1 * poly.get_zorder() ) See also examples/zorder_demo.py JDH
Hi, I am trying to overplot symbols on a region filled (with pale grey color) between two curves. For some reason the filled region is always ON TOP of the symbols so that I don't see them.. (I wanted to use transparency with alpha, but then it is to build a postscript figure which does not support transparency, so this requires me to first plot the filled region and then overplot the symbols...) here is an example: sampVS = arange(0.,1.,0.02) x = concatenate( (sampVS,sampVS[::-1]) ) alpha1 = 0.98486328 alpha2 = 1.28486328 y1 = alpha1 * sampVS / sqrt(1.+(alpha1 * sampVS)**2) y2 = alpha2 * sampVS / sqrt(1.+(alpha2 * sampVS)**2) y = concatenate( (y1,y2[::-1]) ) p = fill(x, y, facecolor=(0.9,0.9,0.9)) scatter([0.4],[0.4]) ==> the symbol is hidden behind the filled region although it is plotted afterwards... thanks for any input here!! Eric -- ==================================================================== Eric Emsellem ems...@ob... Centre de Recherche Astrophysique de Lyon 9 av. Charles-Andre tel: +33 (0)4 78 86 83 84 69561 Saint-Genis Laval Cedex fax: +33 (0)4 78 86 83 86 France http://www-obs.univ-lyon1.fr/eric.emsellem ====================================================================
>>>>> "Tom" == Tom Denniston <tom...@al...> writes: Tom> I've been profiling some of my code which builds many Tom> somewhat complex graphs. I've noticed that it spends almost Tom> all it's time in the __init__ of the artist class. The time Tom> there is almost entirely spent on calling identity_transform Tom> which builds a SeperableTransform that does no Tom> transforming--from what I can tell--which is consistent with Tom> the name. The identity transform function buid a bunch of Tom> other objects all of which are the same each time. My Tom> question is, does it really need to build all these objects Tom> over and over again. Given that Artist's __init__ is called Tom> by so many things wouldn't it be better to have some static Tom> constants to define these default transformation functions? Tom> Am I missing something subtle or would this be an Tom> improvement? I'm hesitant to make a single (shared) identity transform since transforms are mutable. But since most objects to not use the identity_transform but rather a custom one, we can create it lazily. I've implemented these changes in svn. Each artist (as before) has a _transform instance but now it defaults to None. Then in get_transform def get_transform(self): 'return the Transformation instance used by this artist' if self._transform is None: self._transform = identity_transform() return self._transform The harder part was modifying all of the derived classes that were using the _transform attr directly -- all these had to be ported to use get_transform instead. The changes are documented in API_CHANGES. See if it speeds up your code -- it didn't make an appreciable change to backend_driver. Note the artist constructor shouldn't be a bottleneck in your python script. If it is, you are probably creating lots-o-artists and you might be able to use a collection instead. Eg, if you are making hundreds or thousands of calls to plot and creating a comparable number of Line2D artists, use a LineCollection instead. But if you are still experiencing a problem and the changes I made to svn don't help (eg if you are creating lots of objects that do require the default identity_transform), you can experiment with using a single cached identity_transform. Something like import matplotlib.artist _cached_transform = matplotlib.artist.identity_transform() def my_identity_transform(): return _cached_transform matplotlib.artist.identity_transform = my_identity_transform # import the rest of mpl here Hope this helps... JDH
I've been profiling some of my code which builds many somewhat complex graphs. I've noticed that it spends almost all it's time in the __init__ of the artist class. The time there is almost entirely spent on calling identity_transform which builds a SeperableTransform that does no transforming--from what I can tell--which is consistent with the name. The identity transform function buid a bunch of other objects all of which are the same each time. My question is, does it really need to build all these objects over and over again. Given that Artist's __init__ is called by so many things wouldn't it be better to have some static constants to define these default transformation functions? Am I missing something subtle or would this be an improvement? What do people think? def zero(): return Value(0) def one() : return Value(1) def origin(): return Point( zero(), zero() ) def unit_bbox(): """ Get a 0,0 -> 1,1 Bbox instance """ return Bbox( origin(), Point( one(), one() ) ) def identity_affine(): """ Get an affine transformation that maps x,y -> x,y """ return Affine(one(), zero(), zero(), one(), zero(), zero()) def identity_transform(): """ Get an affine transformation that maps x,y -> x,y """ return SeparableTransformation(unit_bbox(), unit_bbox(), Func(IDENTITY), Func(IDENTITY))
Piter_ wrote: > If I start python (2.3). > > >from pylab import * > plot([1,2,3]) > nothing happens. what if you then type: show() -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...
Hi John, * John Hunter <jdh...@ac...> wrote: >>>>>> "Fabian" == Fabian Braennstroem <f.b...@gm...> writes: > > >> I am trying to install matplotlib 0.87.7 with my newly separate > >> installed python 2.5. For this I installed 'pygtk 2.4.1' and > >> numpy 1.0 using this python 2.5 installation. Now, running > >> 'python2.5 setup.py build' I get this error: > >> > >> ... /usr/include/pygtk-2.0/pygobject.h:140: error: expected > >> `,' or `...' before "typename" > > >> it seems, that matplotlib tries to use the old installed pygtk > >> version; the new one is located in /usr/local/include/... > > Yes, this is the old pygtk bug covered in this FAQ > > http://matplotlib.sourceforge.net/faq.html#PYGTK24 Sorry, I did not see that ... thanks! > > maptlotlib gets its gtk configuration from the pkg-config commands, eg > > > pkg-config --cflags-only-I gtk+-2.0 > > make sure your pkg-config is picking up the new pygtk you have > installed, and if not set the PKG_CONFIG_PATH environment variable. > See 'man pkg-config' for more details. > > Fabian> from matplotlib.pylab import * File > Fabian> "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/pylab.py", > Fabian> line 199, in <module> import mlab #so I can override hist, > Fabian> psd, etc... File > Fabian> "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/mlab.py", > Fabian> line 6 4, in <module> import nxutils File > Fabian> "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/nxutils.py", > Fabian> lin e 17, in <module> from matplotlib._ns_nxutils import * > Fabian> ImportError: No module named _ns_nxutils > >>>> import numpy > > It appears you did not have numpy installed when you built > matplotlib. Grab numpy-1.0 from http://numpy.scipy.org and install it > (it's an easy install compared to mpl). Then rebuild and reinstall > matplotlib and you should be good to go. The numpy module is actually working (at least I could do an 'import numpy' without any response and was installed before the matplotlib!? I try it again ... Thanks and Greetings! Fabian
>>>>> "Fabian" == Fabian Braennstroem <f.b...@gm...> writes: >> I am trying to install matplotlib 0.87.7 with my newly separate >> installed python 2.5. For this I installed 'pygtk 2.4.1' and >> numpy 1.0 using this python 2.5 installation. Now, running >> 'python2.5 setup.py build' I get this error: >> >> ... /usr/include/pygtk-2.0/pygobject.h:140: error: expected >> `,' or `...' before "typename" >> it seems, that matplotlib tries to use the old installed pygtk >> version; the new one is located in /usr/local/include/... Yes, this is the old pygtk bug covered in this FAQ http://matplotlib.sourceforge.net/faq.html#PYGTK24 maptlotlib gets its gtk configuration from the pkg-config commands, eg > pkg-config --cflags-only-I gtk+-2.0 make sure your pkg-config is picking up the new pygtk you have installed, and if not set the PKG_CONFIG_PATH environment variable. See 'man pkg-config' for more details. Fabian> from matplotlib.pylab import * File Fabian> "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/pylab.py", Fabian> line 199, in <module> import mlab #so I can override hist, Fabian> psd, etc... File Fabian> "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/mlab.py", Fabian> line 6 4, in <module> import nxutils File Fabian> "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/nxutils.py", Fabian> lin e 17, in <module> from matplotlib._ns_nxutils import * Fabian> ImportError: No module named _ns_nxutils >>>> import numpy It appears you did not have numpy installed when you built matplotlib. Grab numpy-1.0 from http://numpy.scipy.org and install it (it's an easy install compared to mpl). Then rebuild and reinstall matplotlib and you should be good to go. JDH
>>>>> "Piter" == Piter <x....@gm...> writes: Piter> Hi all. I am new user of matplot-lib and Python. I try to Piter> find replacement for matlab. Now I use Debian-testing but Piter> my experience with it is little. I have reinstalled system Piter> few days ago and matplotlib is not working now. If I start Piter> python (2.3). >> from pylab import * Piter> plot([1,2,3]) nothing happens. Piter> from IDLE it does not work to. To run matplotlib from idle, you need to make the following changes to your matplotlibrc file backend : TkAgg interactive : True See http: //matplotlib.sourceforge.net/matplotlibrc for details on the rc file and http://matplotlib.sourceforge.net/interactive.html for an explanation of what these settings mean. JDH
>>>>> "Brent" == Brent Fillery <bfi...@me...> writes: Brent> Hi All Brent> I am new to Matplotlib, and was wondering if anybody knew Brent> of an easy way to construct a dropline from a data point in Brent> a plot to the x axis, i.e. a vertical line from (x1,y1) to Brent> (x1,0)? ax.plot((x1, x1), (y1, 0), linestyle='-', color='black', linewidth=2) should do it... There are some helper functions vline and axvline you may want to look at http://matplotlib.sourceforge.net/matplotlib.pylab.html#-axvline http://matplotlib.sourceforge.net/matplotlib.pylab.html#-vline The first will draw a vertical line that spans the axes vertical extent regardless of zoom level, and the second simply draws a vertical line at a given x from y1 to y2. vline supports many vertical lines and for a single one as in your example, it's easy enough to just use plot. JDH
Hi all. I am new user of matplot-lib and Python. I try to find replacement for matlab. Now I use Debian-testing but my experience with it is little. I have reinstalled system few days ago and matplotlib is not working now. If I start python (2.3). >from pylab import * plot([1,2,3]) nothing happens. from IDLE it does not work to. if i run ipython -pylab It works How can I connect matplotlib to IDLE, or something similar. Thanks. Petro
Again, the problem with the sample you supply is that you are making 2-D arrays where what you need are 1-D arrays. Simply flattening y and pred before using them makes the script work fine, as attached. Or make them 1-D in the first place. Eric Giorgio Luciano wrote: > Thanks to all for the replies :) > I used a tuple to solve the problem because I dind't manage to reshape > my array since it comes from a previous slicing, but not it seems to work. > Is it the same problem because this doesn't work ? > > from pylab import * > y=array([[ 1.02], [ 1.05], [ 1.03], [ 0.99], [ 0.97], [ 0.95], [ 1. ], > [ 0.93], [ 1. ], [ 1. ], [ 0.98], [ 0.98], [ 0.94], [ 0.94], [ > 0.96], [ 0.92], [ 1.01], [ 0.96], [ 0.99], [ 0.96], [ 1.03], [ > 0.91], [ 0.99], [ 0.98], [ 1. ], [ 0.98], [ 0.96]]) > pred=array([[ 1.02875 ], [ 1.03125 ], [ 1.02291667], [ 0.99541667], > [ 0.96458333], [ 0.93625 ], [ 0.99375 ], [ 0.93708333], [ 1.00125 > ], [ 1.01875 ], [ 0.98541667], [ 0.97291667], > [ 0.94708333], [ 0.93458333], [ 0.96625 ], [ 0.92375 ], > [ 1.005 ], [ 0.965 ], [ 0.98333333], [ 0.96666667], [ > 1.02666667], [ 0.91333333], [ 1.005 ], [ 0.965 ], [ 0.98 ], > [ 0.98 ], [ 0.98 ]]) > figure(2) > r=27 > p2=plot(y,pred,'bo') > t1=arange(1,r+1) > for t1 in arange(1,r+1): > text(y[t1-1], pred[t1-1], str(t1)) > show() > ###### End Plot 2 > > and gives this error ??Exception in Tkinter callback > Traceback (most recent call last): > File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__ > return self.func(*args) > File > "C:\Python24\Lib\site-packages\matplotlib\backends\backend_tkagg.py", > line 151, in resize > self.show() > File > "C:\Python24\Lib\site-packages\matplotlib\backends\backend_tkagg.py", > line 154, in draw > FigureCanvasAgg.draw(self) > File > "C:\Python24\Lib\site-packages\matplotlib\backends\backend_agg.py", line > 392, in draw > self.figure.draw(renderer) > File "C:\Python24\Lib\site-packages\matplotlib\figure.py", line 545, > in draw > for a in self.axes: a.draw(renderer) > File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 1067, in > draw > a.draw(renderer) > File "C:\Python24\Lib\site-packages\matplotlib\text.py", line 340, in draw > bbox, info = self._get_layout(renderer) > File "C:\Python24\Lib\site-packages\matplotlib\text.py", line 168, in > _get_layout > if self.cached.has_key(key): return self.cached[key] > TypeError: unhashable type > > Thanks to all community :) > Giorgio
Thanks to all for the replies :) I used a tuple to solve the problem because I dind't manage to reshape my array since it comes from a previous slicing, but not it seems to work. Is it the same problem because this doesn't work ? from pylab import * y=array([[ 1.02], [ 1.05], [ 1.03], [ 0.99], [ 0.97], [ 0.95], [ 1. ], [ 0.93], [ 1. ], [ 1. ], [ 0.98], [ 0.98], [ 0.94], [ 0.94], [ 0.96], [ 0.92], [ 1.01], [ 0.96], [ 0.99], [ 0.96], [ 1.03], [ 0.91], [ 0.99], [ 0.98], [ 1. ], [ 0.98], [ 0.96]]) pred=array([[ 1.02875 ], [ 1.03125 ], [ 1.02291667], [ 0.99541667], [ 0.96458333], [ 0.93625 ], [ 0.99375 ], [ 0.93708333], [ 1.00125 ], [ 1.01875 ], [ 0.98541667], [ 0.97291667], [ 0.94708333], [ 0.93458333], [ 0.96625 ], [ 0.92375 ], [ 1.005 ], [ 0.965 ], [ 0.98333333], [ 0.96666667], [ 1.02666667], [ 0.91333333], [ 1.005 ], [ 0.965 ], [ 0.98 ], [ 0.98 ], [ 0.98 ]]) figure(2) r=27 p2=plot(y,pred,'bo') t1=arange(1,r+1) for t1 in arange(1,r+1): text(y[t1-1], pred[t1-1], str(t1)) show() ###### End Plot 2 and gives this error ??Exception in Tkinter callback Traceback (most recent call last): File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__ return self.func(*args) File "C:\Python24\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line 151, in resize self.show() File "C:\Python24\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line 154, in draw FigureCanvasAgg.draw(self) File "C:\Python24\Lib\site-packages\matplotlib\backends\backend_agg.py", line 392, in draw self.figure.draw(renderer) File "C:\Python24\Lib\site-packages\matplotlib\figure.py", line 545, in draw for a in self.axes: a.draw(renderer) File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 1067, in draw a.draw(renderer) File "C:\Python24\Lib\site-packages\matplotlib\text.py", line 340, in draw bbox, info = self._get_layout(renderer) File "C:\Python24\Lib\site-packages\matplotlib\text.py", line 168, in _get_layout if self.cached.has_key(key): return self.cached[key] TypeError: unhashable type Thanks to all community :) Giorgio
Hi, me again :-) * Fabian Braennstroem <f.b...@gm...> wrote: > Hi, > > I am trying to install matplotlib 0.87.7 with my newly > separate installed python 2.5. For this I installed 'pygtk > 2.4.1' and numpy 1.0 using this python 2.5 installation. > Now, running 'python2.5 setup.py build' I get this error: > > ... > /usr/include/pygtk-2.0/pygobject.h:140: error: expected `,' or `...' before "typename" > /usr/include/pygtk-2.0/pygobject.h:147: error: expected `,' or `...' before "typename" > ./CXX/Extensions.hxx: In constructor `Py::PythonExtension<T>::PythonExtension() [with T = BufferRegion]': > src/_backend_agg.h:50: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > ./CXX/Extensions.hxx: In constructor `Py::PythonExtension<T>::PythonExtension() [with T = LazyValue]': > src/_transforms.h:57: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > ./CXX/Extensions.hxx: In constructor `Py::PythonExtension<T>::PythonExtension() [with T = Func]': > src/_transforms.h:379: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > ./CXX/Extensions.hxx: In constructor `Py::PythonExtension<T>::PythonExtension() [with T = FuncXY]': > src/_transforms.h:466: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > ./CXX/Extensions.hxx: In constructor `Py::PythonExtension<T>::PythonExtension() [with T = Transformation]': > src/_transforms.h:538: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include -I. -Isrc -Iswig -Iagg23/include -I. -I/usr/local/include -I/usr/include -I. -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -Isrc/freetype2 -Iswig/freetype2 -Iagg23/include/freetype2 -I./freetype2 -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/include/pygtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/opt/python-2.5/include/python2.5 -c src/_gtkagg.cpp -o build/temp.linux-i686-2.5/src/_gtkagg.o" failed with exit status 1 > > it seems, that matplotlib tries to use the old installed pygtk version; the new > one is located in /usr/local/include/... I could fix this problem with setting: BUILD_AGG = 0 BUILD_GTKAGG = 0 BUILD_GTK = 1 but now, I get the following problem: node1~$ python2.5 [05 Dec 7:45am] Python 2.5 (r25:51908, Dec 2 2006, 19:02:24) [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pylab The import of the numpy version of the nxutils module, _nsnxutils, failed. This is is either because numpy was unavailable when matplotlib was compiled, because a dependency of _nsnxutils could not be satisfied, or because the build flag for this module was turned off in setup.py. If it appears that _nsnxutils was not built, make sure you have a working copy of numpy and then re-install matplotlib. Otherwise, the following traceback gives more details: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/python-2.5//lib/python2.5/site-packages/pylab.py", line 1, in <modu le> from matplotlib.pylab import * File "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/pylab.py", line 199, in <module> import mlab #so I can override hist, psd, etc... File "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/mlab.py", line 6 4, in <module> import nxutils File "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/nxutils.py", lin e 17, in <module> from matplotlib._ns_nxutils import * ImportError: No module named _ns_nxutils >>> import numpy >>> I checked the setup script; it says: # these are not optional BUILD_FT2FONT = 1 BUILD_CONTOUR = 1 BUILD_NXUTILS = 1 so _nxutils should be installed and numpy loads without any problems!? Does anybody have an idea? Greetings! Fabian
That worked. Thanx a lot Eric. I just had to also add interpolation='nearest' in imshow() and it worked just like matshow did. >From: Eric Firing <ef...@ha...> >To: TheSaint 555 <the...@ho...> >CC: mat...@li... >Subject: Re: [Matplotlib-users] subplots of matshow >Date: 2006年12月04日 14:42:20 -1000 > >def matshow(*args,**kw): > """Display an array as a matrix in a new figure window. > > >Matshow simply is not designed to work with subplots; it is a wrapper >around imshow() that creates a new figure. You should be able to do what >you want by using imshow() directly in place of matshow with something like >this: > >nr, nc = Z.shape >extent = [-0.5, nc-0.5, nr-0.5, -0.5] >imshow(Z, extent=extent, origin='upper') > >This should display the matrix with the same orientation as it has when >printed, and with the axis ticks matching the indices. > >Change or add kwargs to imshow as needed. aspect is 'equal' by default, >which may or may not be what you want, but it is part of what matshow tries >to do if the matrix aspect ratio is not too far from unity. > >Eric > > > > >TheSaint 555 wrote: >>I am trying to create subplots with matshow. However, my code seems to be >>displaying only the last matshow image and two blank plots in separate >>figures. Can someone tell me what I am doing wrong? >> >>from matplotlib.pylab import * >> >>def SliceMat(N, i): >> slice = zeros( (N, N) ) >> for j in range(N): >> for k in range(N): >> val = 0 # black >> if(i>j>k and ((i+j+k)%3==1)): >> val=1 # red >> if(j>k>i and ((i+j+k)%3==2)): >> val=2 # yellow >> if (k>i>j and ((i+j+k)%3==0)): >> val=3 # white >> slice[j,k] = val >> return slice >> >>N=8 >> >> >>subplot(121) >>slice = SliceMat(N, 2) >>matshow(slice, cmap=cm.hot, origin='lower') >> >> >> >>subplot(122) >>slice = SliceMat(N, 5) >>matshow(slice, cmap=cm.hot, origin='lower') >> >>show() >> >>_________________________________________________________________ >>Connect with your friends who use Yahoo! Messenger with Voice. Click! >>http://www.msnspecials.in/wlmyahoo/index.asp >> >> >>------------------------------------------------------------------------- >>Take Surveys. Earn Cash. Influence the Future of IT >>Join SourceForge.net's Techsay panel and you'll get the chance to share >>your >>opinions on IT & business topics through brief surveys - and earn cash >>http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >>_______________________________________________ >>Matplotlib-users mailing list >>Mat...@li... >>https://lists.sourceforge.net/lists/listinfo/matplotlib-users > _________________________________________________________________ Get up-to-date with movies, music and TV. Its happening on MSN Entertainment http://content.msn.co.in/Entertainment/Default
def matshow(*args,**kw): """Display an array as a matrix in a new figure window. Matshow simply is not designed to work with subplots; it is a wrapper around imshow() that creates a new figure. You should be able to do what you want by using imshow() directly in place of matshow with something like this: nr, nc = Z.shape extent = [-0.5, nc-0.5, nr-0.5, -0.5] imshow(Z, extent=extent, origin='upper') This should display the matrix with the same orientation as it has when printed, and with the axis ticks matching the indices. Change or add kwargs to imshow as needed. aspect is 'equal' by default, which may or may not be what you want, but it is part of what matshow tries to do if the matrix aspect ratio is not too far from unity. Eric TheSaint 555 wrote: > I am trying to create subplots with matshow. However, my code seems to be > displaying only the last matshow image and two blank plots in separate > figures. Can someone tell me what I am doing wrong? > > from matplotlib.pylab import * > > def SliceMat(N, i): > slice = zeros( (N, N) ) > for j in range(N): > for k in range(N): > val = 0 # black > if(i>j>k and ((i+j+k)%3==1)): > val=1 # red > if(j>k>i and ((i+j+k)%3==2)): > val=2 # yellow > if (k>i>j and ((i+j+k)%3==0)): > val=3 # white > slice[j,k] = val > return slice > > N=8 > > > subplot(121) > slice = SliceMat(N, 2) > matshow(slice, cmap=cm.hot, origin='lower') > > > > subplot(122) > slice = SliceMat(N, 5) > matshow(slice, cmap=cm.hot, origin='lower') > > show() > > _________________________________________________________________ > Connect with your friends who use Yahoo! Messenger with Voice. Click! > http://www.msnspecials.in/wlmyahoo/index.asp > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users