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



Showing results of 117

1 2 3 .. 5 > >> (Page 1 of 5)
From: Neal B. <ndb...@gm...> - 2014年04月30日 14:18:07
Paul Hobson wrote:
> The only pyplot function I let myself use is plt.subplots() to quickly
> create the Figure and Axes objects. From that point on, I operate on those
> objects directly. Frankly, it reads almost exactly like pyplot code, but it
> is a *lot* more clear what's going on.
> 
...
Actually this is going to be harder than I thought. Looking around for some 
examples of API not using pyplot I'm not turning up much. If I look at 
http://matplotlib.org/api/index.html
I quickly find myself staring at pyplot docs, and if I look at a few 
http://matplotlib.org/examples/index.html
I see pyplot examples.
Where would I find non-pyplot examples and docs?
From: Hattersley, R. <ric...@me...> - 2014年04月30日 14:16:50
Hi,
I'm trying to display a mosaic of image tiles in a single plot, but I keep
getting lines between the tiles. Is there a way to avoid these lines?
(I'd really rather not pre-process the images to stitch them all together
into a single image.)
The following code reproduces the problem:
 
import matplotlib.pyplot as plt
import numpy as np
 
e1 = (27, 31.5, 31.5, 36)
e2 = (31.5, 36, 31.5, 36)
 
image = np.zeros((10, 10))
for e in (e1, e2):
 plt.imshow(image, extent=e)
plt.xlim(27, 36)
plt.show()
I've also tried the following with no improvement:
 plt.imshow(image, extent=e, interpolation='none', resample=False)
Thanks,
Richard Hattersley
From: Paul H. <pmh...@gm...> - 2014年04月30日 13:54:31
The only pyplot function I let myself use is plt.subplots() to quickly
create the Figure and Axes objects. From that point on, I operate on those
objects directly. Frankly, it reads almost exactly like pyplot code, but it
is a *lot* more clear what's going on.
On Wed, Apr 30, 2014 at 4:49 AM, Neal Becker <ndb...@gm...> wrote:
> I've never used matlab (and hope never to have to). But I've been using
> pyplot
> api for mpl for quite a while.
>
> Is there any good reason to move to the "native" mpl api and drop pyplot?
> I ask
> because as I understand, pyplot is intended as a matlab workalike, and
> since I
> never learned matlab I have no need for that crutch. OTOH, I'm quite used
> to
> the pyplot api at this point.
>
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos. Get
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Benjamin R. <ben...@ou...> - 2014年04月30日 13:22:36
I wrote up my answer to this question on stackoverflow once:
https://stackoverflow.com/questions/19895262/when-to-use-the-matplotlib-pyplot-class-and-when-to-use-the-plot-object-matplot/21004357#21004357
Others may have different opinions or variations on the theme, but this is
how I look at the issue. It is also the reason why I don't want to
deprecate pylab (but do want to keep it out of examples).
Cheers!
Ben Root
On Wed, Apr 30, 2014 at 7:49 AM, Neal Becker <ndb...@gm...> wrote:
> I've never used matlab (and hope never to have to). But I've been using
> pyplot
> api for mpl for quite a while.
>
> Is there any good reason to move to the "native" mpl api and drop pyplot?
> I ask
> because as I understand, pyplot is intended as a matlab workalike, and
> since I
> never learned matlab I have no need for that crutch. OTOH, I'm quite used
> to
> the pyplot api at this point.
>
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos. Get
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Neal B. <ndb...@gm...> - 2014年04月30日 11:49:47
I've never used matlab (and hope never to have to). But I've been using pyplot 
api for mpl for quite a while.
Is there any good reason to move to the "native" mpl api and drop pyplot? I ask 
because as I understand, pyplot is intended as a matlab workalike, and since I 
never learned matlab I have no need for that crutch. OTOH, I'm quite used to 
the pyplot api at this point.
I already got the answer:
 ax = plt.gca()
 def format_coord(x, y):
 return 'x=%.4f, y=%.4f'%(m(x, y, inverse = True))
 ax.format_coord = format_coord
This does exactly what I wanted. :-)
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Interactively-get-readable-i-e-lng-lat-coordinates-from-a-matplotlib-basemap-plot-tp43328p43330.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jonathan_Kowalik <jon...@na...> - 2014年04月29日 15:36:05
Hi.
I also asked this question on stackoverflow, but I think it might even
better to ask it here.
I'm doing basemap plots. The current coordinates of the mouse pointer are
interactively displayed in the lower right area of the figure. But they are
in map coordinates (I assume). I would like to have them in lng/lat.
Is there a quick way to do this?
Do I have to dive into mouse events (which I'm not familiar with yet)?
Thanks!
Jonathan
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Interactively-get-readable-i-e-lng-lat-coordinates-from-a-matplotlib-basemap-plot-tp43328.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Paul H. <pmh...@gm...> - 2014年04月29日 13:32:24
As the error says, you need the dateutil package. It available here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-dateutil
On Mon, Apr 28, 2014 at 11:10 PM, Stam Golesh <sta...@gm...> wrote:
> hi all
>
> downloaded and installed
> matplotlib-1.3.1.win32-py3.2.exe
>
> this is what i get
> >>> import matplotlib
> Traceback (most recent call last):
> File "<pyshell#6>", line 1, in <module>
> import matplotlib
> File "E:\programs\python
> 3.2.3\lib\site-packages\matplotlib\__init__.py", line 112, in <module>
> raise ImportError("matplotlib requires dateutil")
> ImportError: matplotlib requires dateutil
>
> now what?
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos. Get
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Stam G. <sta...@gm...> - 2014年04月29日 06:10:45
hi all
downloaded and installed
matplotlib-1.3.1.win32-py3.2.exe
this is what i get
>>> import matplotlib
Traceback (most recent call last):
 File "<pyshell#6>", line 1, in <module>
 import matplotlib
 File "E:\programs\python 3.2.3\lib\site-packages\matplotlib\__init__.py",
line 112, in <module>
 raise ImportError("matplotlib requires dateutil")
ImportError: matplotlib requires dateutil
now what?
From: Peter S. <sh...@gm...> - 2014年04月28日 23:29:02
Beautiful. Thanks much....
-P.
On Mon, Apr 28, 2014 at 7:21 PM, Paul Ivanov <pi...@be...> wrote:
> Peter Shenkin, on 2014年04月28日 19:17, wrote:
> > I am using the Zoom button that appears next to the Pan button.
>
> Click the House/Home button that is all the way to the left of
> the toolbar.
>
> best,
> --
> _
> / \
> A* \^ -
> ,./ _.`\\ / \
> / ,--.S \/ \
> / `"~,_ \ \
> __o ?
> _ \<,_ /:\
> --(_)/-(_)----.../ | \
> --------------.......J
> Paul Ivanov
> http://pirsquared.org
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos. Get
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Paul I. <pi...@be...> - 2014年04月28日 23:21:12
Peter Shenkin, on 2014年04月28日 19:17, wrote:
> I am using the Zoom button that appears next to the Pan button.
Click the House/Home button that is all the way to the left of
the toolbar.
best,
-- 
 _
 / \
 A* \^ -
 ,./ _.`\\ / \
 / ,--.S \/ \
 / `"~,_ \ \
 __o ?
 _ \<,_ /:\
--(_)/-(_)----.../ | \
--------------.......J
Paul Ivanov
http://pirsquared.org
From: Paul I. <pi...@be...> - 2014年04月28日 23:19:46
hopfrog, on 2014年04月28日 16:12, wrote:
> After I've used the "Zoom to Rectangle" control (next to Pan) to expand the
> view of a selected rectangle, what do I do to undo the zoom and restore the
> full view? 
You can restore the original "Home" view by pressing "h". Use 'c'
and 'v' keys to go back and forth between views (in case you do
several operations).
best,
-- 
 _
 / \
 A* \^ -
 ,./ _.`\\ / \
 / ,--.S \/ \
 / `"~,_ \ \
 __o ?
 _ \<,_ /:\
--(_)/-(_)----.../ | \
--------------.......J
Paul Ivanov
http://pirsquared.org
From: Peter S. <sh...@gm...> - 2014年04月28日 23:17:46
Hi,
After using the Zoom to Rectangle control, how do I undo the operation to
restore the original view?
I am using the Zoom button that appears next to the Pan button.
We're using matplotlib-1.2.1-py2.7-macosx-10.5-x86_64.
Thanks,
-P.
From: hopfrog <sh...@gm...> - 2014年04月28日 23:13:01
Hi, 
After I've used the "Zoom to Rectangle" control (next to Pan) to expand the
view of a selected rectangle, what do I do to undo the zoom and restore the
full view? 
Thanks, 
-H.
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/How-to-undo-Zoom-to-Rectangle-tp43319.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Nathan L. <nal...@gm...> - 2014年04月28日 10:05:09
Jerzy,
Yes, understood.
The issue here is that the function is documented incorrectly and I have made a pull request to fix that.
Best regards,
Nathan.
________________________________
 From: Jerzy Karczmarczuk <jer...@un...>
To: mat...@li... 
Sent: Monday, 28 April 2014, 10:02
Subject: Re: [Matplotlib-users] Entropy calculation incorrect?
 
This is a side-remark.
Please, don't exaggerate with the term "incorrect". Binary, decimal, 
natural... logarithms, all this is just a matter of multiplicative 
CONSTANT, and sometimes a question of convention.
I am a physicist, and for "us" the entropy is NOT given in bits. We use 
natural logarithms, and in order to have the units appropriate for 
statistical physics / thermodynamics, we multiply the result by the 
Boltzmann constant, 1.38*10^(-23) Joule/Kelvin, and that's it.
Anyway, Eric Firing is right, all this has nothing to do with Matplotlib.
Best regards.
Jerzy Karczmarczuk
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users 
From: Jerzy K. <jer...@un...> - 2014年04月28日 09:02:50
This is a side-remark.
Please, don't exaggerate with the term "incorrect". Binary, decimal, 
natural... logarithms, all this is just a matter of multiplicative 
CONSTANT, and sometimes a question of convention.
I am a physicist, and for "us" the entropy is NOT given in bits. We use 
natural logarithms, and in order to have the units appropriate for 
statistical physics / thermodynamics, we multiply the result by the 
Boltzmann constant, 1.38*10^(-23) Joule/Kelvin, and that's it.
Anyway, Eric Firing is right, all this has nothing to do with Matplotlib.
Best regards.
Jerzy Karczmarczuk
From: Nathan L. <nal...@gm...> - 2014年04月28日 08:18:44
Eric,
Thanks. I have submitted a pull request to fix the documentation as you suggested.
https://github.com/matplotlib/matplotlib/pull/3018
Thanks for your help,
Nathan (aka captainwhippet)
________________________________
 From: Eric Firing <ef...@ha...>
To: mat...@li... 
Sent: Friday, 25 April 2014, 19:38
Subject: Re: [Matplotlib-users] Entropy calculation incorrect?
 
Nathan,
Thanks for bringing this up. It looks like the short-term fix is to 
make the documentation match the code. Longer term, it seems to me like 
this is the sort of thing that should be deprecated; it doesn't belong 
in matplotlib any more.
Would you open an issue on Github, please? Even better: submit a pull 
request that fixes the documentation.
Eric
On 2014年04月25日 1:26 AM, Nathan Lindop wrote:
> Hello,
>
> I have been using the matplotlib.mlab.entropy function and have noticed
> that it may be incorrect. I have posted a question on stackoverflow here:
> http://stackoverflow.com/questions/23291576/matplotlib-mlab-entropy-calculation-incorrect
>
> I thought I would should it on the mailing list too. Does anyone have
> any ideas?
>
> Thanks,
> Nathan
>
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users 
From: <cl...@br...> - 2014年04月25日 18:49:24
Dear colleagues, 
Is there a artist function or routine available in matplotlib for drawing 
animated arrows following lines (like streamplot) in a 2D space, or even 
better in a 3D space? 
Thanks in advance for any hint, or sample code. 
Regards, 
Claude
Claude Falbriard 
Certified IT Specialist L2 - Middleware
AMS Hortolândia / SP - Brazil
phone: +55 13 9 9760 0453
cell: +55 13 9 8117 3316
e-mail: cl...@br...
From: Eric F. <ef...@ha...> - 2014年04月25日 18:42:55
On 2014年04月24日 11:40 PM, Tom Grydeland wrote:
> Hi all,
>
> I will explain what I’m trying to achieve first, then the approaches I’ve attempted so far, with results.
>
> I have data on a 2D grid which I want to present as an image — a la pyplot.imshow() — except that the grid is hexagonal, not rectangular. The grid can be represented in multiple ways, I use a regular 2D array with the convention that the lower left hex is (0,0), x increases to the right (crossing vertical hex boundaries) and y increases upwards slanting to the right.
>
Tom,
Have you considered adapting the code from the Axes.hexbin() method?
Ideally, the hexbin method might be split into two parts, one for the 
calculation and another for the plotting.
Eric
> Ideally, I’d also be able to have a colorbar.
>
> I’m giving my routines three input vectors: x, y and c. X and y are initially integers, then transformed to centerpoint coordinates using
> x, y = x+.5*y, y*np.cos(np.pi/6)
> while c is used to look up values in a colormap.
>
> I first tried to adapt ‘scatter_demo2.py’ to my needs. Unfortunately, the pyplot.scatter routine fails when given ‘c’ or ’s’ keywords, as has been reported elsewhere by somebody else:
> http://stackoverflow.com/questions/20524888/attributeerror-numpy-ndarray-object-has-no-attribute-get-matrix
>
> I’ve dug around in the code for a bit without finding out how this arises. It seems to me it has to do with how transforms are being handed around and at what point their representation is changed from objects to pure matrices. This backend appears to expect to see objects only, but is handed matrices instead. I’ve hacked my way around that one in backends/backend_macosx.py by changing lines around 79-80 from
> master_transform = master_transform.get_matrix()
> all_transforms = [t.get_matrix() for t in all_transforms]
> to
> try:
> master_transform = master_transform.get_matrix()
> except AttributeError: pass
> try:
> all_transforms = [t.get_matrix() for t in all_transforms]
> except AttributeError: pass
> (which is a dirty hack, but I don’t know how to do it right)
>
> Now I can run the scatter_demo2 script, and I can obviously have it produce hexes at uniform size, but the size of the hexagons are set independently of the axes. Good for symbols used to mark arbitrary coordinates, not so good when I try to cover the plane without gaps.
>
> Next, I’ve tried creating the patches one by one, essentially this:
>
> r = 1./np.sqrt(3)
> for xy, cc in zip(zip(x, y), c):
> hexp = mpl.patches.RegularPolygon(xy, 6, radius=r, facecolor=cc, edgecolor=’none')
> ax.add_patch(hexp)
> ax.autoscale_view()
> ax.figure.canvas.draw()
>
> This works as I want it to, but becomes unbearably slow when the number of hexes grows beyond a few thousand.
>
> Given that RegularPolygon can do the trick, it seems likely that RegularPolyCollection should also be able to?
>
> This is what I tried:
>
> ax = gca()
> collection = RegularPolyCollection(
> 6, # a pentagon
> rotation=(np.pi/7,),
> sizes=(.5/np.sqrt(3),),
> facecolors = cc,
> edgecolors = None,
> linewidths = (1,),
> offsets = zip(xx,yy),
> transOffset = ax.transData,
> )
> #collection.set_transform(ax.transData)
> ax.add_collection(collection, autolim=True)
>
> ax.autoscale_view()
> ax.figure.canvas.draw()
>
> This produces dots of minute sizes at the desired coordinates. I can tweak the size to make them bigger, but they don’t scale with the axes, as for the scatter_demo script used initially. Digging in the docs, I found a reference to the set_transform() method of Artists, so I tried setting that to ax.transData (the line commented out in the above snippet), and voila! I have hexagons covering the plane again. Strangely enough, they’re not in the right place anymore (and the locations change when zooming in or out), the sizes aren’t _quite_ right, the autoscaling of axes appear to believe the patches are where I wanted them to be, not where they appear on the plot, results are very different if saving to a figure instead of drawing to a figure window, etc.
>
> Is there a way I can make RegularPolyCollection patches transform with axes coordinates in the same way that RegularPolygon patches do?
>
> Am I barking up the wrong tree, is there another, blindingly obvious, way I should be doing this?
>
> The observant reader will also notice the strange rotation keyword given to RegularPolyCollection. This keyword is ignored in the macosx backend, and I have been unable to find out why.
>
> Thank you for all tips and pointers
>
> --Tom Grydeland
>
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Eric F. <ef...@ha...> - 2014年04月25日 18:39:04
Nathan,
Thanks for bringing this up. It looks like the short-term fix is to 
make the documentation match the code. Longer term, it seems to me like 
this is the sort of thing that should be deprecated; it doesn't belong 
in matplotlib any more.
Would you open an issue on Github, please? Even better: submit a pull 
request that fixes the documentation.
Eric
On 2014年04月25日 1:26 AM, Nathan Lindop wrote:
> Hello,
>
> I have been using the matplotlib.mlab.entropy function and have noticed
> that it may be incorrect. I have posted a question on stackoverflow here:
> http://stackoverflow.com/questions/23291576/matplotlib-mlab-entropy-calculation-incorrect
>
> I thought I would should it on the mailing list too. Does anyone have
> any ideas?
>
> Thanks,
> Nathan
>
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Paul H. <pmh...@gm...> - 2014年04月25日 14:49:37
You might have more luck reading in that data (dates with mixed format)
with pandas than numpy.
On Fri, Apr 25, 2014 at 2:37 AM, Mark Bakker <ma...@gm...> wrote:
> Thanks, Andreas, but it doesn't quite work.
>
> This works for me (I manually changed all dates to 'day-month-year' for
> testing):
>
> a = loadtxt('test.csv',converters={2:strpdate2num('%d-%m-%Y')})
>
> But when I define the same function in a separate function, as you
> suggested:
>
> def conv_date(s):
> return strpdate2num('%d-%m-%Y')
>
> and do
>
> a = loadtxt('test.csv',converters={2:conv_date})
>
> I get the non-descript error:
>
> loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols,
> unpack, ndmin)
> 847 fh.close()
> 848
> --> 849 X = np.array(X, dtype)
> 850 # Multicolumn data are returned with shape (1, N, M), i.e.
> 851 # (1, 1, M) for a single row - remove the singleton dimension
> there
>
> SystemError: error return without exception set
>
> Any suggestions?
>
> Thanks, Mark
>
>
>
>
> On Fri, Apr 25, 2014 at 11:17 AM, Andreas Hilboll <li...@hi...>wrote:
>
>> On 25.04.2014 11:02, Mark Bakker wrote:
>> > OK, I figured out I can use:
>> > converters={0:strpdate2num('%d-%m-%y')}
>> >
>> > What now if part of my dates are given as 'day-month-year' and part as
>> > 'day/month/year' in the same file (I know, who does that, an I could do
>> > a replace first and then read it in). Can I specify both formats for the
>> > converter? I guess not....
>>
>> Try this:
>>
>> def _conv_date(s):
>> try:
>> return strpdate2num('%d-%m-%y')
>> except Exception: # figure out which exception class to use
>> return strpdate2num('%d/%m/%y')
>>
>> converters={0:_conv_date}
>>
>> Cheers, Andreas.
>>
>>
>> >
>> > Thanks,
>> >
>> > Mark
>> >
>> >
>> >
>> > On Fri, Apr 25, 2014 at 10:46 AM, Mark Bakker <ma...@gm...
>> > <mailto:ma...@gm...>> wrote:
>> >
>> > Hello List,
>> >
>> > datestr2num works great when dates are stored as month/day/year (as
>> > American like).
>> >
>> > Europeans store them as day/month/year.
>> >
>> > Any quick function to convert a day/month/year string do a date? Is
>> > there an eu version: datestr2numeu?
>> >
>> > Thanks,
>> >
>> > Mark
>> >
>> >
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> > Start Your Social Network Today - Download eXo Platform
>> > Build your Enterprise Intranet with eXo Platform Software
>> > Java Based Open Source Intranet - Social, Extensible, Cloud Ready
>> > Get Started Now And Turn Your Intranet Into A Collaboration Platform
>> > http://p.sf.net/sfu/ExoPlatform
>> >
>> >
>> >
>> > _______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >
>>
>>
>> --
>> -- Andreas.
>>
>
>
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Nathan L. <nal...@gm...> - 2014年04月25日 11:29:32
Hello,
I have been using the matplotlib.mlab.entropy function and have noticed that it may be incorrect. I have posted a question on stackoverflow here:
http://stackoverflow.com/questions/23291576/matplotlib-mlab-entropy-calculation-incorrect
I thought I would should it on the mailing list too. Does anyone have any ideas?
Thanks,
Nathan
From: Tom G. <tom...@gm...> - 2014年04月25日 09:40:45
Hi all,
I will explain what I’m trying to achieve first, then the approaches I’ve attempted so far, with results.
I have data on a 2D grid which I want to present as an image — a la pyplot.imshow() — except that the grid is hexagonal, not rectangular. The grid can be represented in multiple ways, I use a regular 2D array with the convention that the lower left hex is (0,0), x increases to the right (crossing vertical hex boundaries) and y increases upwards slanting to the right.
Ideally, I’d also be able to have a colorbar.
I’m giving my routines three input vectors: x, y and c. X and y are initially integers, then transformed to centerpoint coordinates using
 x, y = x+.5*y, y*np.cos(np.pi/6)
while c is used to look up values in a colormap.
I first tried to adapt ‘scatter_demo2.py’ to my needs. Unfortunately, the pyplot.scatter routine fails when given ‘c’ or ’s’ keywords, as has been reported elsewhere by somebody else:
 http://stackoverflow.com/questions/20524888/attributeerror-numpy-ndarray-object-has-no-attribute-get-matrix
I’ve dug around in the code for a bit without finding out how this arises. It seems to me it has to do with how transforms are being handed around and at what point their representation is changed from objects to pure matrices. This backend appears to expect to see objects only, but is handed matrices instead. I’ve hacked my way around that one in backends/backend_macosx.py by changing lines around 79-80 from
 master_transform = master_transform.get_matrix()
 all_transforms = [t.get_matrix() for t in all_transforms]
to
 try:
 master_transform = master_transform.get_matrix()
 except AttributeError: pass
 try:
 all_transforms = [t.get_matrix() for t in all_transforms]
 except AttributeError: pass
(which is a dirty hack, but I don’t know how to do it right)
Now I can run the scatter_demo2 script, and I can obviously have it produce hexes at uniform size, but the size of the hexagons are set independently of the axes. Good for symbols used to mark arbitrary coordinates, not so good when I try to cover the plane without gaps.
Next, I’ve tried creating the patches one by one, essentially this:
 r = 1./np.sqrt(3)
 for xy, cc in zip(zip(x, y), c):
 hexp = mpl.patches.RegularPolygon(xy, 6, radius=r, facecolor=cc, edgecolor=’none')
 ax.add_patch(hexp)
 ax.autoscale_view()
 ax.figure.canvas.draw()
This works as I want it to, but becomes unbearably slow when the number of hexes grows beyond a few thousand.
Given that RegularPolygon can do the trick, it seems likely that RegularPolyCollection should also be able to?
This is what I tried:
 ax = gca()
 collection = RegularPolyCollection(
 6, # a pentagon
 rotation=(np.pi/7,),
 sizes=(.5/np.sqrt(3),),
 facecolors = cc,
 edgecolors = None,
 linewidths = (1,),
 offsets = zip(xx,yy),
 transOffset = ax.transData,
 )
 #collection.set_transform(ax.transData)
 ax.add_collection(collection, autolim=True)
 ax.autoscale_view()
 ax.figure.canvas.draw()
This produces dots of minute sizes at the desired coordinates. I can tweak the size to make them bigger, but they don’t scale with the axes, as for the scatter_demo script used initially. Digging in the docs, I found a reference to the set_transform() method of Artists, so I tried setting that to ax.transData (the line commented out in the above snippet), and voila! I have hexagons covering the plane again. Strangely enough, they’re not in the right place anymore (and the locations change when zooming in or out), the sizes aren’t _quite_ right, the autoscaling of axes appear to believe the patches are where I wanted them to be, not where they appear on the plot, results are very different if saving to a figure instead of drawing to a figure window, etc.
Is there a way I can make RegularPolyCollection patches transform with axes coordinates in the same way that RegularPolygon patches do?
Am I barking up the wrong tree, is there another, blindingly obvious, way I should be doing this?
The observant reader will also notice the strange rotation keyword given to RegularPolyCollection. This keyword is ignored in the macosx backend, and I have been unable to find out why.
Thank you for all tips and pointers
--Tom Grydeland
From: Mark B. <ma...@gm...> - 2014年04月25日 09:37:53
Thanks, Andreas, but it doesn't quite work.
This works for me (I manually changed all dates to 'day-month-year' for
testing):
a = loadtxt('test.csv',converters={2:strpdate2num('%d-%m-%Y')})
But when I define the same function in a separate function, as you
suggested:
def conv_date(s):
 return strpdate2num('%d-%m-%Y')
and do
a = loadtxt('test.csv',converters={2:conv_date})
I get the non-descript error:
loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols,
unpack, ndmin)
 847 fh.close()
 848
--> 849 X = np.array(X, dtype)
 850 # Multicolumn data are returned with shape (1, N, M), i.e.
 851 # (1, 1, M) for a single row - remove the singleton dimension
there
SystemError: error return without exception set
Any suggestions?
Thanks, Mark
On Fri, Apr 25, 2014 at 11:17 AM, Andreas Hilboll <li...@hi...> wrote:
> On 25.04.2014 11:02, Mark Bakker wrote:
> > OK, I figured out I can use:
> > converters={0:strpdate2num('%d-%m-%y')}
> >
> > What now if part of my dates are given as 'day-month-year' and part as
> > 'day/month/year' in the same file (I know, who does that, an I could do
> > a replace first and then read it in). Can I specify both formats for the
> > converter? I guess not....
>
> Try this:
>
> def _conv_date(s):
> try:
> return strpdate2num('%d-%m-%y')
> except Exception: # figure out which exception class to use
> return strpdate2num('%d/%m/%y')
>
> converters={0:_conv_date}
>
> Cheers, Andreas.
>
>
> >
> > Thanks,
> >
> > Mark
> >
> >
> >
> > On Fri, Apr 25, 2014 at 10:46 AM, Mark Bakker <ma...@gm...
> > <mailto:ma...@gm...>> wrote:
> >
> > Hello List,
> >
> > datestr2num works great when dates are stored as month/day/year (as
> > American like).
> >
> > Europeans store them as day/month/year.
> >
> > Any quick function to convert a day/month/year string do a date? Is
> > there an eu version: datestr2numeu?
> >
> > Thanks,
> >
> > Mark
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Start Your Social Network Today - Download eXo Platform
> > Build your Enterprise Intranet with eXo Platform Software
> > Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> > Get Started Now And Turn Your Intranet Into A Collaboration Platform
> > http://p.sf.net/sfu/ExoPlatform
> >
> >
> >
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
> --
> -- Andreas.
>
From: Andreas H. <li...@hi...> - 2014年04月25日 09:35:10
On 25.04.2014 11:02, Mark Bakker wrote:
> OK, I figured out I can use:
> converters={0:strpdate2num('%d-%m-%y')}
> 
> What now if part of my dates are given as 'day-month-year' and part as
> 'day/month/year' in the same file (I know, who does that, an I could do
> a replace first and then read it in). Can I specify both formats for the
> converter? I guess not....
Try this:
 def _conv_date(s):
 try:
 return strpdate2num('%d-%m-%y')
 except Exception: # figure out which exception class to use
 return strpdate2num('%d/%m/%y')
 converters={0:_conv_date}
Cheers, Andreas.
> 
> Thanks,
> 
> Mark
> 
> 
> 
> On Fri, Apr 25, 2014 at 10:46 AM, Mark Bakker <ma...@gm...
> <mailto:ma...@gm...>> wrote:
> 
> Hello List,
> 
> datestr2num works great when dates are stored as month/day/year (as
> American like).
> 
> Europeans store them as day/month/year.
> 
> Any quick function to convert a day/month/year string do a date? Is
> there an eu version: datestr2numeu?
> 
> Thanks,
> 
> Mark
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> 
> 
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
-- Andreas.

Showing results of 117

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