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
(8) |
3
|
4
(6) |
5
|
|
6
|
7
(41) |
8
(18) |
9
(25) |
10
(18) |
11
(10) |
12
(13) |
|
13
(7) |
14
(4) |
15
(12) |
16
(6) |
17
(9) |
18
(7) |
19
(2) |
|
20
(5) |
21
(7) |
22
(2) |
23
(11) |
24
(11) |
25
(14) |
26
(3) |
|
27
(3) |
28
(17) |
29
(7) |
30
(16) |
31
(8) |
|
|
|
From: Michiel de H. <mjl...@ya...> - 2011-03-23 20:34:48
|
OK, thanks. I got the same behavior using Python (instead of ipython).
Non-interactive usage has not yet been implemented in the MacOSX backend. We should be able to fix the bug that you found when implementing interactive/non-interactive usage for the MacOSX backend.
Thanks,
--Michiel.
--- On Wed, 3/23/11, Daniel Welling <dan...@gm...> wrote:
From: Daniel Welling <dan...@gm...>
Subject: Re: [Matplotlib-users] Qt4 on OSX
To: "Michiel de Hoon" <mjl...@ya...>
Cc: mat...@li...
Date: Wednesday, March 23, 2011, 12:27 PM
Greetings again, Michiel. Please excuse my slow response time...
First, thanks for explaining the Framework stuff; it clarifies situation. I'll be sure to never blame the OSX backend where it is not warranted!
Unfortunately (in terms of easy explanations):In [3]: MacOS.WMAvailable()Out[3]: True
crap.
Fortunately, I've been able to nail down the problem:
bash-3.2$ ipythonPython 2.6.6 (r266:84292, Jan 18 2011, 14:07:55) Type "copyright", "credits" or "license" for more information.
IPython 0.10.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.%quickref -> Quick reference.help -> Python's own help system.object? -> Details about 'object'. ?object also works, ?? prints more.
In [2]: import matplotlib.pyplot as pltIn [3]: plt.plot([0,1])Out[3]: [<matplotlib.lines.Line2D object at 0x118c6be90>]In [4]: plt.show()(Here, saving the plot works like normal.)
In [5]: plt.ion()In [6]: plt.plot([0,1])Out[6]: [<matplotlib.lines.Line2D object at 0x118c8bc90>](Now, when trying to save the plot, the "save" and "cancel" buttons no longer respond. I must kill python from another terminal.)
So that's the situation with OSX. It's something that comes up frequently enough (typically a quick plot turns into a more thorough customization followed by the lockup) that TK becomes a more viable option for me though OSX is faster and has better file navigation features. Again, if QT4 was working, that is certainly my weapon of choice...
On Mon, Mar 21, 2011 at 7:14 AM, Michiel de Hoon <mjl...@ya...> wrote:
--- On Sun, 3/20/11, Daniel Welling <dan...@gm...> wrote:
> The OSX backend used to have a bug where you cannot type a
> name in the file name text box.Since that has been fixed, ...
That was not a bug in the MacOSX backend (and therefore was not fixed), but is related to how Python is installed on your system: If your Python is not a framework installation, it will not interact correctly with Apple's windowing manager. This is due to OS X itself and is independent of the MacOSX backend.
I
have found a new bug: every so often, when you go to save a file, the
"save" and "cancel" button stop responding, trapping the user in file
saving limbo. I'll have to play with it again to figure out what
triggers this.
Can you check if your Python is built as a framework? If it is, MacOS.WMAvailable() should return True:
$ python
Python 2.7.1 (r271:86832, Mar 12 2011, 13:44:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MacOS
>>> MacOS.WMAvailable()
True
>>>
Best,
--Michiel.
|
|
From: Paul I. <piv...@gm...> - 2011-03-23 19:58:17
|
Adrian HILL, on 2011-03-23 19:42, wrote:
> Hi, I am new to python and matplotlib and have a small question.
>
> Is there a way to autoscale the y axis for the current x range in view?
>
> Currently, my y axes are scaled to all the data.
Hi Adrian,
there isn't a built-in way of doing this at the moment, because
the general case would require going through all of the plotted
data and finding the min&max for only the parts of the data that
are withing some range (as apposed to the min&max for all data).
If there's some regularity about your data, or if you know that
you'll have only a few (maybe even just one?) artist, you could
implement such functionality using callbacks, such as
'xlim_changed' or 'ylim_changed'.
The quickest way would be to have those callbacks adjust
ax.dataLim and then call autoscale.
plt.clf()
ax = plt.gca()
data = np.sin(np.linspace(0,10,100))
ax.plot(data)
def cb(ax):
start,stop = [int(x) for x in ax.get_xlim()]
d = data[start:stop+1]
ax.dataLim._points[:,1] = d.min(), d.max()
# the previous line would need to change depending on your
# data
ax.autoscale_view(scalex=False,scaley=True)
plt.draw()
ax.callbacks.connect('xlim_changed',cb)
plt.xlim(0,30)
# for the next line to work in ipython you'll need to
# paste/or cpaste this entire script, or just pause before
# changing the xlim again to verify that it works as intended
raw_input("press return for to rescale")
plt.xlim(0,55)
best,
--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
|
|
From: C M <cmp...@gm...> - 2011-03-23 19:46:33
|
I'm not sure if this is going to work to solve an issue I'm having, but I'd
like to try it before asking a much more complex question. I have a
function, loose_autoscale_view(), that is based on the autoscale_view
function in mpl but allows margin arguments to push the margins out a bit
more.
I'd like to try to alter it to allow certain lines belonging to an axis to
not be taken into consideration when autoscaling. I can alter it to accept
a list of lines to be excluded, but then I don't know how to exclude them
when calculating the autoscaling. I think the key line in the function is
this one:
bb = mtransforms.BboxBase.union(dl)
because that union gets the sub-BBoxes for all the lines...so is there a way
to exclude some? Or is there a better approach?
Thanks. The function is below.
-Che
def loose_autoscale_view(self, subplot, xmargin, ymargin, tight=False,
scalex=True, scaley=True):
"""
autoscale the view limits using the data limits. You can
selectively autoscale only a single axis, eg, the xaxis by
setting *scaley* to *False*. The autoscaling preserves any
axis direction reversal that has already been done.
I have added a way to make it not quite so tight using xmargin and
ymargin.
"""
# if image data only just use the datalim
#if not self.subplot._autoscaleon: return
if scalex:
xshared = subplot._shared_x_axes.get_siblings(subplot)
dl = [ax.dataLim for ax in xshared]
bb = mtransforms.BboxBase.union(dl)
xdiff = bb.intervalx[1] - bb.intervalx[0]
x0 = bb.intervalx[0]-xdiff * xmargin
x1 = bb.intervalx[1]+xdiff * xmargin
if scaley:
yshared = subplot._shared_y_axes.get_siblings(subplot)
dl = [ax.dataLim for ax in yshared]
bb = mtransforms.BboxBase.union(dl)
y0_untampered = bb.intervaly[0]-(bb.intervaly[1])
y0 = bb.intervaly[0]-(bb.intervaly[1]* ymargin)
y1_untampered = bb.intervaly[1]
y1 = bb.intervaly[1]* (1+ymargin)
if (tight or (len(subplot.images)>0 and
len(subplot.lines)==0 and
len(subplot.patches)==0)):
if scalex:
subplot.set_xbound(x0, x1)
if scaley:
subplot.set_ybound(y0, y1)
return
if scalex:
XL = subplot.xaxis.get_major_locator().view_limits(x0, x1)
subplot.set_xbound(XL)
if scaley:
YL = subplot.yaxis.get_major_locator().view_limits(y0, y1)
subplot.set_ybound(YL)
|
|
From: Adrian H. <adr...@es...> - 2011-03-23 18:42:25
|
Hi, I am new to python and matplotlib and have a small question. Is there a way to autoscale the y axis for the current x range in view? Currently, my y axes are scaled to all the data. Thanks Adrian |
|
From: Daniel W. <dan...@gm...> - 2011-03-23 16:27:50
|
Greetings again, Michiel. Please excuse my slow response time... First, thanks for explaining the Framework stuff; it clarifies situation. I'll be sure to never blame the OSX backend where it is not warranted! Unfortunately (in terms of easy explanations): In [3]: MacOS.WMAvailable() Out[3]: True crap. Fortunately, I've been able to nail down the problem: bash-3.2$ ipython Python 2.6.6 (r266:84292, Jan 18 2011, 14:07:55) Type "copyright", "credits" or "license" for more information. IPython 0.10.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [2]: import matplotlib.pyplot as plt In [3]: plt.plot([0,1]) Out[3]: [<matplotlib.lines.Line2D object at 0x118c6be90>] In [4]: plt.show() (Here, saving the plot works like normal.) In [5]: plt.ion() In [6]: plt.plot([0,1]) Out[6]: [<matplotlib.lines.Line2D object at 0x118c8bc90>] (Now, when trying to save the plot, the "save" and "cancel" buttons no longer respond. I must kill python from another terminal.) So that's the situation with OSX. It's something that comes up frequently enough (typically a quick plot turns into a more thorough customization followed by the lockup) that TK becomes a more viable option for me though OSX is faster and has better file navigation features. Again, if QT4 was working, that is certainly my weapon of choice... On Mon, Mar 21, 2011 at 7:14 AM, Michiel de Hoon <mjl...@ya...>wrote: > --- On *Sun, 3/20/11, Daniel Welling <dan...@gm...>* wrote: > > The OSX backend used to have a bug where you cannot type a > > name in the file name text box.Since that has been fixed, ... > That was not a bug in the MacOSX backend (and therefore was not fixed), but > is related to how Python is installed on your system: If your Python is not > a framework installation, it will not interact correctly with Apple's > windowing manager. This is due to OS X itself and is independent of the > MacOSX backend. > > I have found a new bug: every so often, when you go to save a file, the > "save" and "cancel" button stop responding, trapping the user in file saving > limbo. I'll have to play with it again to figure out what triggers this. > > Can you check if your Python is built as a framework? If it is, > MacOS.WMAvailable() should return True: > > $ python > Python 2.7.1 (r271:86832, Mar 12 2011, 13:44:53) > [GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import MacOS > >>> MacOS.WMAvailable() > True > >>> > > > Best, > --Michiel. > > > |
|
From: Warren W. <war...@en...> - 2011-03-23 14:46:03
|
On Wed, Mar 23, 2011 at 8:43 AM, Sean Lake <ody...@gm...> wrote:
> Hello all,
>
> I need to draw different hatch styles on the different groups of a stacked
> bar chart in order to make a figure that works properly in black and white.
> The devil is, I can't figure out how to do it. When I pass the hatch option
> a list of values, I get an error.
>
Looks like the 'hatch' keyword must be a single string, not a list. You can
set the hatch style of the patches in the plot after calling hist():
-----
from numpy import *
import matplotlib.pyplot as plt
hatches = ['/', '+', '*', '\\', 'x', '.', '-', 'o']
result = plt.hist( [ linspace(1, 10, 20), linspace(1, 10, 40)],
bins=len(hatches), histtype="barstacked", rwidth=1.0, label=["a", "b"],
color=["red", "green"])
plist1 = result[2][0]
plist2 = result[2][1]
for h, p1, p2 in zip(hatches, plist1, plist2):
p1.set_hatch(h)
p2.set_hatch(h)
plt.show()
-----
Warren
> A simple example:
> from numpy import *
> import matplotlib.pyplot as plt
>
> plt.hist( [ linspace(1, 10, 20), linspace(1, 10, 40)], bins=range(10),
> histtype="barstacked", rwidth=1.0, label=["a", "b"],
> color=["red", "green"], hatch=["/", "x"] )
> plt.show()
>
> The resulting errors/outputs are at the end of the email.
>
> Thanks in advance for any help,
> Sean Lake
>
> In [4]: plt.hist( [ linspace(1, 10, 20), linspace(1, 10, 40)],
> bins=range(10), histtype
> ="barstacked", rwidth=1.0, label=["a", "b"],
> ...: color=["red", "green"], hatch=["/", "x"] )
> Out[4]:
> ([array([0, 3, 2, 2, 2, 2, 2, 2, 2]), array([0, 5, 4, 4, 5, 4, 4, 5, 4])],
> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),
> <a list of 2 Lists of Patches objects>)
>
> In [5]: plt.show()
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call last)
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.pyc in
> expose_event(self, widget, event)
> 391 x, y, w, h = self.allocation
> 392 self._pixmap_prepare (w, h)
> --> 393 self._render_figure(self._pixmap, w, h)
> 394 self._need_redraw = False
> 395
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.pyc in
> _render_figure(self, pixmap, width, height)
> 73 def _render_figure(self, pixmap, width, height):
> 74 if DEBUG: print 'FigureCanvasGTKAgg.render_figure'
> ---> 75 FigureCanvasAgg.draw(self)
> 76 if DEBUG: print 'FigureCanvasGTKAgg.render_figure pixmap',
> pixmap
> 77 #agg_to_gtk_drawable(pixmap, self.renderer._renderer, None)
>
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in
> draw(self)
> 392
> 393 self.renderer = self.get_renderer()
> --> 394 self.figure.draw(self.renderer)
> 395
> 396 def get_renderer(self):
>
> /sw/lib/python2.6/site-packages/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *args, **kwargs)
> 53 def draw_wrapper(artist, renderer, *args, **kwargs):
> 54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *args, **kwargs)
> 56 after(artist, renderer)
> 57
>
> /sw/lib/python2.6/site-packages/matplotlib/figure.pyc in draw(self,
> renderer)
> 796 dsu.sort(key=itemgetter(0))
> 797 for zorder, func, args in dsu:
> --> 798 func(*args)
> 799
> 800 renderer.close_group('figure')
>
> /sw/lib/python2.6/site-packages/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *args, **kwargs)
> 53 def draw_wrapper(artist, renderer, *args, **kwargs):
> 54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *args, **kwargs)
> 56 after(artist, renderer)
> 57
>
> /sw/lib/python2.6/site-packages/matplotlib/axes.pyc in draw(self, renderer,
> inframe)
> 1932
> 1933 for zorder, a in dsu:
> -> 1934 a.draw(renderer)
> 1935
> 1936 renderer.close_group('axes')
>
> /sw/lib/python2.6/site-packages/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *args, **kwargs)
> 53 def draw_wrapper(artist, renderer, *args, **kwargs):
> 54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *args, **kwargs)
> 56 after(artist, renderer)
> 57
>
> /sw/lib/python2.6/site-packages/matplotlib/patches.pyc in draw(self,
> renderer)
> 381 path_effect.draw_path(renderer, gc, tpath, affine,
> rgbFace)
> 382 else:
> --> 383 renderer.draw_path(gc, tpath, affine, rgbFace)
> 384
> 385 gc.restore()
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in
> draw_path(self, gc, path, transform, rgbFace)
> 115 self._renderer.draw_path(gc, p, transform, rgbFace)
> 116 else:
> --> 117 self._renderer.draw_path(gc, path, transform, rgbFace)
> 118
> 119 def draw_mathtext(self, gc, x, y, s, prop, angle):
>
> /sw/lib/python2.6/site-packages/matplotlib/backend_bases.pyc in
> get_hatch_path(self, density)
> 865 if self._hatch is None:
> 866 return None
> --> 867 return Path.hatch(self._hatch, density)
> 868
> 869
>
> /sw/lib/python2.6/site-packages/matplotlib/path.pyc in hatch(cls,
> hatchpattern, density)
> 662 return None
> 663
> --> 664 hatch_path = cls._hatch_dict.get((hatchpattern, density))
> 665 if hatch_path is not None:
> 666 return hatch_path
>
> TypeError: unhashable type: 'list'
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call last)
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.pyc in
> expose_event(self, widget, event)
> 391 x, y, w, h = self.allocation
> 392 self._pixmap_prepare (w, h)
> --> 393 self._render_figure(self._pixmap, w, h)
> 394 self._need_redraw = False
> 395
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.pyc in
> _render_figure(self, pixmap, width, height)
> 73 def _render_figure(self, pixmap, width, height):
> 74 if DEBUG: print 'FigureCanvasGTKAgg.render_figure'
> ---> 75 FigureCanvasAgg.draw(self)
> 76 if DEBUG: print 'FigureCanvasGTKAgg.render_figure pixmap',
> pixmap
> 77 #agg_to_gtk_drawable(pixmap, self.renderer._renderer, None)
>
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in
> draw(self)
> 392
> 393 self.renderer = self.get_renderer()
> --> 394 self.figure.draw(self.renderer)
> 395
> 396 def get_renderer(self):
>
> /sw/lib/python2.6/site-packages/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *args, **kwargs)
> 53 def draw_wrapper(artist, renderer, *args, **kwargs):
> 54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *args, **kwargs)
> 56 after(artist, renderer)
> 57
>
> /sw/lib/python2.6/site-packages/matplotlib/figure.pyc in draw(self,
> renderer)
> 796 dsu.sort(key=itemgetter(0))
> 797 for zorder, func, args in dsu:
> --> 798 func(*args)
> 799
> 800 renderer.close_group('figure')
>
> /sw/lib/python2.6/site-packages/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *args, **kwargs)
> 53 def draw_wrapper(artist, renderer, *args, **kwargs):
> 54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *args, **kwargs)
> 56 after(artist, renderer)
> 57
>
> /sw/lib/python2.6/site-packages/matplotlib/axes.pyc in draw(self, renderer,
> inframe)
> 1932
> 1933 for zorder, a in dsu:
> -> 1934 a.draw(renderer)
> 1935
> 1936 renderer.close_group('axes')
>
> /sw/lib/python2.6/site-packages/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *args, **kwargs)
> 53 def draw_wrapper(artist, renderer, *args, **kwargs):
> 54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *args, **kwargs)
> 56 after(artist, renderer)
> 57
>
> /sw/lib/python2.6/site-packages/matplotlib/patches.pyc in draw(self,
> renderer)
> 381 path_effect.draw_path(renderer, gc, tpath, affine,
> rgbFace)
> 382 else:
> --> 383 renderer.draw_path(gc, tpath, affine, rgbFace)
> 384
> 385 gc.restore()
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in
> draw_path(self, gc, path, transform, rgbFace)
> 115 self._renderer.draw_path(gc, p, transform, rgbFace)
> 116 else:
> --> 117 self._renderer.draw_path(gc, path, transform, rgbFace)
> 118
> 119 def draw_mathtext(self, gc, x, y, s, prop, angle):
>
> /sw/lib/python2.6/site-packages/matplotlib/backend_bases.pyc in
> get_hatch_path(self, density)
> 865 if self._hatch is None:
> 866 return None
> --> 867 return Path.hatch(self._hatch, density)
> 868
> 869
>
> /sw/lib/python2.6/site-packages/matplotlib/path.pyc in hatch(cls,
> hatchpattern, density)
> 662 return None
> 663
> --> 664 hatch_path = cls._hatch_dict.get((hatchpattern, density))
> 665 if hatch_path is not None:
> 666 return hatch_path
>
> TypeError: unhashable type: 'list'
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call last)
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.pyc in
> expose_event(self, widget, event)
> 391 x, y, w, h = self.allocation
> 392 self._pixmap_prepare (w, h)
> --> 393 self._render_figure(self._pixmap, w, h)
> 394 self._need_redraw = False
> 395
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.pyc in
> _render_figure(self, pixmap, width, height)
> 73 def _render_figure(self, pixmap, width, height):
> 74 if DEBUG: print 'FigureCanvasGTKAgg.render_figure'
> ---> 75 FigureCanvasAgg.draw(self)
> 76 if DEBUG: print 'FigureCanvasGTKAgg.render_figure pixmap',
> pixmap
> 77 #agg_to_gtk_drawable(pixmap, self.renderer._renderer, None)
>
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in
> draw(self)
> 392
> 393 self.renderer = self.get_renderer()
> --> 394 self.figure.draw(self.renderer)
> 395
> 396 def get_renderer(self):
>
> /sw/lib/python2.6/site-packages/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *args, **kwargs)
> 53 def draw_wrapper(artist, renderer, *args, **kwargs):
> 54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *args, **kwargs)
> 56 after(artist, renderer)
> 57
>
> /sw/lib/python2.6/site-packages/matplotlib/figure.pyc in draw(self,
> renderer)
> 796 dsu.sort(key=itemgetter(0))
> 797 for zorder, func, args in dsu:
> --> 798 func(*args)
> 799
> 800 renderer.close_group('figure')
>
> /sw/lib/python2.6/site-packages/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *args, **kwargs)
> 53 def draw_wrapper(artist, renderer, *args, **kwargs):
> 54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *args, **kwargs)
> 56 after(artist, renderer)
> 57
>
> /sw/lib/python2.6/site-packages/matplotlib/axes.pyc in draw(self, renderer,
> inframe)
> 1932
> 1933 for zorder, a in dsu:
> -> 1934 a.draw(renderer)
> 1935
> 1936 renderer.close_group('axes')
>
> /sw/lib/python2.6/site-packages/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *args, **kwargs)
> 53 def draw_wrapper(artist, renderer, *args, **kwargs):
> 54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *args, **kwargs)
> 56 after(artist, renderer)
> 57
>
> /sw/lib/python2.6/site-packages/matplotlib/patches.pyc in draw(self,
> renderer)
> 381 path_effect.draw_path(renderer, gc, tpath, affine,
> rgbFace)
> 382 else:
> --> 383 renderer.draw_path(gc, tpath, affine, rgbFace)
> 384
> 385 gc.restore()
>
> /sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in
> draw_path(self, gc, path, transform, rgbFace)
> 115 self._renderer.draw_path(gc, p, transform, rgbFace)
> 116 else:
> --> 117 self._renderer.draw_path(gc, path, transform, rgbFace)
> 118
> 119 def draw_mathtext(self, gc, x, y, s, prop, angle):
>
> /sw/lib/python2.6/site-packages/matplotlib/backend_bases.pyc in
> get_hatch_path(self, density)
> 865 if self._hatch is None:
> 866 return None
> --> 867 return Path.hatch(self._hatch, density)
> 868
> 869
>
> /sw/lib/python2.6/site-packages/matplotlib/path.pyc in hatch(cls,
> hatchpattern, density)
> 662 return None
> 663
> --> 664 hatch_path = cls._hatch_dict.get((hatchpattern, density))
> 665 if hatch_path is not None:
> 666 return hatch_path
>
> TypeError: unhashable type: 'list'
>
>
>
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Sean L. <ody...@gm...> - 2011-03-23 13:43:32
|
Hello all,
I need to draw different hatch styles on the different groups of a stacked bar chart in order to make a figure that works properly in black and white. The devil is, I can't figure out how to do it. When I pass the hatch option a list of values, I get an error.
A simple example:
from numpy import *
import matplotlib.pyplot as plt
plt.hist( [ linspace(1, 10, 20), linspace(1, 10, 40)], bins=range(10), histtype="barstacked", rwidth=1.0, label=["a", "b"],
color=["red", "green"], hatch=["/", "x"] )
plt.show()
The resulting errors/outputs are at the end of the email.
Thanks in advance for any help,
Sean Lake
In [4]: plt.hist( [ linspace(1, 10, 20), linspace(1, 10, 40)], bins=range(10), histtype
="barstacked", rwidth=1.0, label=["a", "b"],
...: color=["red", "green"], hatch=["/", "x"] )
Out[4]:
([array([0, 3, 2, 2, 2, 2, 2, 2, 2]), array([0, 5, 4, 4, 5, 4, 4, 5, 4])],
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),
<a list of 2 Lists of Patches objects>)
In [5]: plt.show()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.pyc in expose_event(self, widget, event)
391 x, y, w, h = self.allocation
392 self._pixmap_prepare (w, h)
--> 393 self._render_figure(self._pixmap, w, h)
394 self._need_redraw = False
395
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.pyc in _render_figure(self, pixmap, width, height)
73 def _render_figure(self, pixmap, width, height):
74 if DEBUG: print 'FigureCanvasGTKAgg.render_figure'
---> 75 FigureCanvasAgg.draw(self)
76 if DEBUG: print 'FigureCanvasGTKAgg.render_figure pixmap', pixmap
77 #agg_to_gtk_drawable(pixmap, self.renderer._renderer, None)
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
392
393 self.renderer = self.get_renderer()
--> 394 self.figure.draw(self.renderer)
395
396 def get_renderer(self):
/sw/lib/python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 def draw_wrapper(artist, renderer, *args, **kwargs):
54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
56 after(artist, renderer)
57
/sw/lib/python2.6/site-packages/matplotlib/figure.pyc in draw(self, renderer)
796 dsu.sort(key=itemgetter(0))
797 for zorder, func, args in dsu:
--> 798 func(*args)
799
800 renderer.close_group('figure')
/sw/lib/python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 def draw_wrapper(artist, renderer, *args, **kwargs):
54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
56 after(artist, renderer)
57
/sw/lib/python2.6/site-packages/matplotlib/axes.pyc in draw(self, renderer, inframe)
1932
1933 for zorder, a in dsu:
-> 1934 a.draw(renderer)
1935
1936 renderer.close_group('axes')
/sw/lib/python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 def draw_wrapper(artist, renderer, *args, **kwargs):
54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
56 after(artist, renderer)
57
/sw/lib/python2.6/site-packages/matplotlib/patches.pyc in draw(self, renderer)
381 path_effect.draw_path(renderer, gc, tpath, affine, rgbFace)
382 else:
--> 383 renderer.draw_path(gc, tpath, affine, rgbFace)
384
385 gc.restore()
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in draw_path(self, gc, path, transform, rgbFace)
115 self._renderer.draw_path(gc, p, transform, rgbFace)
116 else:
--> 117 self._renderer.draw_path(gc, path, transform, rgbFace)
118
119 def draw_mathtext(self, gc, x, y, s, prop, angle):
/sw/lib/python2.6/site-packages/matplotlib/backend_bases.pyc in get_hatch_path(self, density)
865 if self._hatch is None:
866 return None
--> 867 return Path.hatch(self._hatch, density)
868
869
/sw/lib/python2.6/site-packages/matplotlib/path.pyc in hatch(cls, hatchpattern, density)
662 return None
663
--> 664 hatch_path = cls._hatch_dict.get((hatchpattern, density))
665 if hatch_path is not None:
666 return hatch_path
TypeError: unhashable type: 'list'
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.pyc in expose_event(self, widget, event)
391 x, y, w, h = self.allocation
392 self._pixmap_prepare (w, h)
--> 393 self._render_figure(self._pixmap, w, h)
394 self._need_redraw = False
395
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.pyc in _render_figure(self, pixmap, width, height)
73 def _render_figure(self, pixmap, width, height):
74 if DEBUG: print 'FigureCanvasGTKAgg.render_figure'
---> 75 FigureCanvasAgg.draw(self)
76 if DEBUG: print 'FigureCanvasGTKAgg.render_figure pixmap', pixmap
77 #agg_to_gtk_drawable(pixmap, self.renderer._renderer, None)
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
392
393 self.renderer = self.get_renderer()
--> 394 self.figure.draw(self.renderer)
395
396 def get_renderer(self):
/sw/lib/python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 def draw_wrapper(artist, renderer, *args, **kwargs):
54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
56 after(artist, renderer)
57
/sw/lib/python2.6/site-packages/matplotlib/figure.pyc in draw(self, renderer)
796 dsu.sort(key=itemgetter(0))
797 for zorder, func, args in dsu:
--> 798 func(*args)
799
800 renderer.close_group('figure')
/sw/lib/python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 def draw_wrapper(artist, renderer, *args, **kwargs):
54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
56 after(artist, renderer)
57
/sw/lib/python2.6/site-packages/matplotlib/axes.pyc in draw(self, renderer, inframe)
1932
1933 for zorder, a in dsu:
-> 1934 a.draw(renderer)
1935
1936 renderer.close_group('axes')
/sw/lib/python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 def draw_wrapper(artist, renderer, *args, **kwargs):
54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
56 after(artist, renderer)
57
/sw/lib/python2.6/site-packages/matplotlib/patches.pyc in draw(self, renderer)
381 path_effect.draw_path(renderer, gc, tpath, affine, rgbFace)
382 else:
--> 383 renderer.draw_path(gc, tpath, affine, rgbFace)
384
385 gc.restore()
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in draw_path(self, gc, path, transform, rgbFace)
115 self._renderer.draw_path(gc, p, transform, rgbFace)
116 else:
--> 117 self._renderer.draw_path(gc, path, transform, rgbFace)
118
119 def draw_mathtext(self, gc, x, y, s, prop, angle):
/sw/lib/python2.6/site-packages/matplotlib/backend_bases.pyc in get_hatch_path(self, density)
865 if self._hatch is None:
866 return None
--> 867 return Path.hatch(self._hatch, density)
868
869
/sw/lib/python2.6/site-packages/matplotlib/path.pyc in hatch(cls, hatchpattern, density)
662 return None
663
--> 664 hatch_path = cls._hatch_dict.get((hatchpattern, density))
665 if hatch_path is not None:
666 return hatch_path
TypeError: unhashable type: 'list'
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.pyc in expose_event(self, widget, event)
391 x, y, w, h = self.allocation
392 self._pixmap_prepare (w, h)
--> 393 self._render_figure(self._pixmap, w, h)
394 self._need_redraw = False
395
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.pyc in _render_figure(self, pixmap, width, height)
73 def _render_figure(self, pixmap, width, height):
74 if DEBUG: print 'FigureCanvasGTKAgg.render_figure'
---> 75 FigureCanvasAgg.draw(self)
76 if DEBUG: print 'FigureCanvasGTKAgg.render_figure pixmap', pixmap
77 #agg_to_gtk_drawable(pixmap, self.renderer._renderer, None)
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
392
393 self.renderer = self.get_renderer()
--> 394 self.figure.draw(self.renderer)
395
396 def get_renderer(self):
/sw/lib/python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 def draw_wrapper(artist, renderer, *args, **kwargs):
54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
56 after(artist, renderer)
57
/sw/lib/python2.6/site-packages/matplotlib/figure.pyc in draw(self, renderer)
796 dsu.sort(key=itemgetter(0))
797 for zorder, func, args in dsu:
--> 798 func(*args)
799
800 renderer.close_group('figure')
/sw/lib/python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 def draw_wrapper(artist, renderer, *args, **kwargs):
54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
56 after(artist, renderer)
57
/sw/lib/python2.6/site-packages/matplotlib/axes.pyc in draw(self, renderer, inframe)
1932
1933 for zorder, a in dsu:
-> 1934 a.draw(renderer)
1935
1936 renderer.close_group('axes')
/sw/lib/python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 def draw_wrapper(artist, renderer, *args, **kwargs):
54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
56 after(artist, renderer)
57
/sw/lib/python2.6/site-packages/matplotlib/patches.pyc in draw(self, renderer)
381 path_effect.draw_path(renderer, gc, tpath, affine, rgbFace)
382 else:
--> 383 renderer.draw_path(gc, tpath, affine, rgbFace)
384
385 gc.restore()
/sw/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc in draw_path(self, gc, path, transform, rgbFace)
115 self._renderer.draw_path(gc, p, transform, rgbFace)
116 else:
--> 117 self._renderer.draw_path(gc, path, transform, rgbFace)
118
119 def draw_mathtext(self, gc, x, y, s, prop, angle):
/sw/lib/python2.6/site-packages/matplotlib/backend_bases.pyc in get_hatch_path(self, density)
865 if self._hatch is None:
866 return None
--> 867 return Path.hatch(self._hatch, density)
868
869
/sw/lib/python2.6/site-packages/matplotlib/path.pyc in hatch(cls, hatchpattern, density)
662 return None
663
--> 664 hatch_path = cls._hatch_dict.get((hatchpattern, density))
665 if hatch_path is not None:
666 return hatch_path
TypeError: unhashable type: 'list'
|
|
From: David C. <dc...@ne...> - 2011-03-23 13:40:30
|
Appologies if this question has been asked previously. I have done a quick search of the archives and have been unable to find a similar question: (I'm quite new to this) I have a set of data in a numpy array which consists of: X_Coord, Y_Coord, Z_level [[x,y,z], [x,y,z], [x,y,z], ....... ...... [x,y,z], [x,y,z]] How do I appropriatley format these arrays of data such that I can feed it to: ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) I WOULD have thought it was as simple as feeding the X value to X the Y value to Y and the Z value to Z in the above command. However this doesnt work. Also: is there a written specification for the data format expected by the above command? It does not seem to take a logical format. (at least logical in my eyes) I look forward to an answer (or more questions) Regards, David |
|
From: Catherine T. <cab...@gm...> - 2011-03-23 10:05:33
|
Thanks for your help, I simplified what I was doing and so changed the data,
which is my fault. Here is some data of similar size to the data I am
plotting:
data1 = np.array([22000, 25000, 27000, 32000, 25000])
data2 = np.array([14000000, 22000000, 3500000, 3000000, 2700000])
When I try to run this with the above code I get a very strange graph and
these errors:
> In [16]: run t.py
> Warning: overflow encountered in long_scalars
> Warning: overflow encountered in long_scalars
> Warning: overflow encountered in long_scalars
> Warning: overflow encountered in long_scalars
> Warning: invalid value encountered in sqrt
>
So then tried the same method using the annotation as suggested (code below)
which worked perfectly.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.ticker import FuncFormatter
labels=('91','92','93','94','95')
data1 = np.array([22000, 25000, 27000, 32000, 25000])
data2 = np.array([14000000, 22000000, 3500000, 3000000, 2700000])
fig = plt.figure()
ax = fig.add_subplot(111)
# the next line is only use to set the proper lims,
p = ax.plot(data1, data2, 'bo', linestyle='-', markersize=3, alpha=0)
for x,y,dx,dy in zip(data1[:-1], data2[:-1], data1[1:], data2[1:]):
ax.annotate('', xy=(dx,dy), xycoords='data',
xytext=(x,y), textcoords='data',
arrowprops=dict(arrowstyle="->"))
ax.set_xlim(21000,33000)
for i, label in enumerate(labels):
x_loc = data1[i]
y_loc = data2[i]
txt = ax.annotate(label, xy=(x_loc, y_loc), size=8,
xytext=(-10, 10), textcoords='offset points',
arrowprops=None)
plt.show()
Just in case someone else has a similar problem.
Thanks
Catherine
|
|
From: Paul I. <piv...@gm...> - 2011-03-23 03:56:07
|
Sachin Kumar Sharma, on 2011-03-23 02:44, wrote: > BB, > > I am Xploting two variables using > Plot(a,b,'o') > > Is it possible to color code the same plot with a 3rd property c instead of color we specify. > > Also advise if it is possible to do 3D Xplot in matplotlib for variables a,b, & c and if possible to color code this 3d plot with 4th variable d. Sashin, use scatter(a,b,c=c, marker='o') to set the color of individual point. There's even an 's' parameter with which you can individually set the size of the marker. npts = 100 a = np.random.rand(npts) b = np.random.rand(npts) c = np.random.rand(npts) d = np.random.rand(npts) plt.scatter(a,b,c=c,s=c*100, marker='o') best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: Sachin K. S. <SSh...@sl...> - 2011-03-23 03:03:18
|
BB, I am Xploting two variables using Plot(a,b,'o') Is it possible to color code the same plot with a 3rd property c instead of color we specify. Also advise if it is possible to do 3D Xplot in matplotlib for variables a,b, & c and if possible to color code this 3d plot with 4th variable d. Cheers Sachin ************************************************************************ Sachin Kumar Sharma Senior Geomodeler |