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

Showing 7 results of 7

From: Isidora <is...@ju...> - 2011年09月22日 23:12:46
Hi,
I am new to matplotlib so I may not have found the right answer because I am looking in the wrong places.
I wrote a script to draw lines on a 800x600 pixels GIF background map. The output image I get is 620x450. Could someone let me know what I am doing wrong?
Code Snippet:
map = Basemap(......)
pilImg = Image.open('bkgmap.gif')
rgba = pil_to_array(pilImg)
map.imshow(rgba)
# Plot some lines and labels here 
....
pyplot.savefig('outimg.png',format='PNG',bbox_inches='tight',pad_inches=0)
Thank you
From: Martijn <mar...@gm...> - 2011年09月22日 21:54:11
Hi,
I am trying to create an ndarry subclass for vector calculations. The
result is not what I intent:
import numpy as np
class Vector(np.ndarray):
	def __abs__(self):
		return(np.sqrt(sum(self**2)))
V = Vector([1,2,3])
print np.sqrt(sum(self**2))
print abs(V)
I do not understand the docs at http://www.scipy.org/Subclasses but it
is late now.
Martijn
P.S. I know this is not strictly matplotlib related, but since MP uses
numpy so heavily, I felt free to ask.
From: Benjamin R. <ben...@ou...> - 2011年09月22日 19:49:59
On Thu, Sep 22, 2011 at 2:31 PM, Andreas Matthias <
and...@gm...> wrote:
> I would like to plot a masked array with plot_surface().
> But unlike imshow() which really plots the masked data,
> plot_surface() only plots the non-masked data.
>
> How can I plot the masked array?
>
> Ciao
> Andreas
>
>
>
> import numpy as np
> import pylab as mpl
> from mpl_toolkits.mplot3d import axes3d
>
> x = np.arange(1,10,1)
> y = np.arange(1,10,1)
> x,y = np.meshgrid(x,y)
> z = x**3 + y**3 - 500
> z = np.ma.masked_array(z, z<0)
>
> cm = mpl.cm.jet
>
> ax1 = mpl.subplot(1,2,1, projection='3d')
> ax1.plot_surface(x,y,z,
> rstride=1, cstride=1, linewidth=0,
> cmap=cm)
>
> ax2 = mpl.subplot(1,2,2)
> ax2.imshow(z, cmap=cm)
>
> mpl.show()
>
>
Andreas,
I once had a patch I made for someone else with this request, but it broke a
bunch of things for regular uses of plot_surface, so I never added it. I
will see if I can dig it up for you as a work-around.
In the meantime, could you file a feature request for this in the github
tracker, please?
Ben Root
From: Andreas M. <and...@gm...> - 2011年09月22日 19:35:30
I would like to plot a masked array with plot_surface().
But unlike imshow() which really plots the masked data,
plot_surface() only plots the non-masked data.
How can I plot the masked array?
Ciao
Andreas
import numpy as np
import pylab as mpl
from mpl_toolkits.mplot3d import axes3d
x = np.arange(1,10,1)
y = np.arange(1,10,1)
x,y = np.meshgrid(x,y)
z = x**3 + y**3 - 500
z = np.ma.masked_array(z, z<0)
cm = mpl.cm.jet
ax1 = mpl.subplot(1,2,1, projection='3d')
ax1.plot_surface(x,y,z,
 rstride=1, cstride=1, linewidth=0,
 cmap=cm)
ax2 = mpl.subplot(1,2,2)
ax2.imshow(z, cmap=cm)
mpl.show()
From: Michael D. <md...@st...> - 2011年09月22日 14:59:30
I'm not able to reproduce the problem: I get the watermark in both png 
and pdf output. This was with git master.
What version of matplotlib are you using? Can you send (off-list) the 
png and pdf files so I can have a look at your output?
Mike
On 09/21/2011 10:28 AM, Dave Hirschfeld wrote:
> Is this a bug in the PDF/SVG backends or am I doing something wrong? If the
> former is there any workaround?
>
> The simple testcase below demonstrates the problem whereby the watermark doesn't
> show up in the pdf output but does in the png output.
>
> import Image
> from scipy import lena
> from scipy.ndimage import map_coordinates
> from cStringIO import StringIO
>
> def add_watermark(fig, watermark):
> import matplotlib.image as image
> im = image.imread(watermark)
> dpi = fig.get_dpi()
> offset = dpi*fig.get_size_inches()[0] - im.shape[1]
> fig.figimage(im, offset, 0, alpha=0.3)
> return fig
> #
>
> im = Image.fromarray(map_coordinates(lena(), mgrid[0:512:100j, 0:512:100j]))
> watermark = StringIO()
> im.save(watermark, format='png')
> watermark.seek(0)
>
> fig = figure(figsize=(12, 8))
> plot(randn(1000))
> add_watermark(fig, watermark)
> fig.savefig('test.png', dpi=fig.get_dpi())
> fig.savefig('test.pdf', dpi=fig.get_dpi())
>
> Thanks,
> Dave
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Armando S. L. <ars...@gm...> - 2011年09月22日 12:11:46
On Wed, Sep 21, 2011 at 9:28 PM, Benjamin Root <ben...@ou...> wrote:
> On Wed, Sep 21, 2011 at 2:00 PM, Armando Serrano Lombillo <
> ars...@gm...> wrote:
>
>> Hello I have a dat set like this one
>> a=[[x1, y1, cat1], [x2, y2, cat1], ..., [x8, y8, cat1], [x9, y9, cat2],
>> ..., [x34, y34, cat2], [x35, y35, cat3],...]
>> and I don't know beforehand how many diffferent categories there will be
>> or how long they will be.
>>
>> I would like to make a plot like this:
>> ax.plot(a[0:i1, 0], a[0:i1, 1], label=cat1)
>> ax.plot(a[i1:i2, 0], a[i1:i2, 1], label=cat2)
>> ax.plot(a[i2:i3, 0], a[i2:i3, 1], label=cat3)
>> ...
>>
>> where i1, i2... are the indices where the data set changes fomt cat1 to
>> cat2, cat2 to cat3...
>>
>> Does anybody see an easy way of coding this?
>>
>> Thanks,
>> Armando.
>>
>
> Maybe something like this? (Warning: untested!)
>
> from collections import OrderedDict
> b = OrderedDict()
> for index, coords in enumerate(a) :
> b[coords[2]] = index + 1
>
> a = np.array([[c[0], c[1]] for c in a])
>
> prevIndex = 0
> for cat, curIndex in b.iteritems() :
> ax.plot(a[prevIndex:curIndex, 0], a[prevIndex:curIndex, 1], label=cat)
> prevIndex = curIndex
>
> The ordered dictionary may or may not be available in whatever version of
> python you use, but it guarantees the order.
>
> I hope that helps!
> Ben Root
>
>
Ok, thanks Ben, I was thinking that maybe with some numpy array manipulation
there might have been a straightforward way I wasn't seeing.
Armando.
From: A. S. B. <ab...@gm...> - 2011年09月22日 08:47:38
Dear all,
I have some large data sets that I need to evaluate graphically. I
find the graph navigation tools (left-click and drag to pan,
right-click and drag to zoom) in matplotlib absolutely superb and I'd
like to be able to better use them with the large data sets.
At the moment, I'm achieving this by plotting subsets of the data to
browse and then when I've completed the assessment, plotting the next
subset of data. This is fairly laborious...
What I'd really like to do is have a matplotlib plot figure appear on
the screen and as I browse it would pass the limits to some callback
function which would provide the data to plot within those limits.
The callback function could then manage the memory a bit better and
only read a subset of the data out of the file at any one time.
Ideally, the figure would hold the data it had while you browse and
(maybe) when you release the mouse button it would get the new data.
The data might not look perfect when you zoom in, but it would quickly
refresh and therefore improve. The callback function could provide a
bit of extra data either side of the visible area on the screen to
make panning work.
Is this a mammoth task involving writing a rather complex application
that reimplements a lot of the matplotlib plotting stuff, or is it
something that can be done relatively easily with the API?
Thanks in advance,
Al

Showing 7 results of 7

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 によって変換されたページ (->オリジナル) /