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






Showing 11 results of 11

From: Cizhong J. <cu...@ps...> - 2007年09月19日 23:59:29
Hi, all,
 
I have a long ylabel that is displayed in two lines. Thus, the ylabel
overlaps with yticklabels. Does anyone know how to control the space between
ylabel and yticklabel? Thank you very much.
 
Best,
cj
From: Shishir R. <sr...@gm...> - 2007年09月19日 23:48:10
Attachments: test.py test.png
Hi,
I am trying to use the simple test.py program to draw a stacked bar graph.
My intention is eventually to shrink this into a sparkline.
Both the sample program and the image output are attached.
What I cannot understand is why the vertical bars don't align to the
y-axis 0 point.
Any help is appreciated.
-shishir
From: Orest K. <ore...@gm...> - 2007年09月19日 21:13:47
I'm embedding a FigureCanvasWxAgg into a wx.Panel and binding key events to
it:
class MyPanel(wx.Panel)
 def __init__(self, parent, file, id=-1):
 wx.Panel.__init__(self, parent,
 style=wx.WANTS_CHARS | wx.NO_FULL_REPAINT_ON_RESIZE)
 #Set up the canvas
 self.figure = Figure((9,8),75)
 self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
 self.subplot = self.figure.add_subplot(111)
 #Set up the toolbar
 self.toolbar = NavigationToolbar2Wx(self.canvas)
 tw, th = self.toolbar.GetSizeTuple()
 fw, fh = self.canvas.GetSizeTuple()
 self.toolbar.SetSize(wx.Size(fw, th))
 #Set up figure manager
 self.figmgr = FigureManager(self.canvas, 1, self)
 self.canvas.Bind(wx.EVT_KEY_UP, self.__keyup)
 self.canvas.Bind(wx.EVT_KEY_DOWN, self.__keydown)
	def self.__keyup(self, evt):
		print 'key up'
	def self.__keydown(self, evt):
		print 'key down'
The program successfully detects keydown events for just about every key
with three major exceptions: wx.WXK_RETURN, wx.WXK_RIGHT, wx.WXK_LEFT.
There may be other keys out there, but those three keys are the ones I need
to process events for. 
I've tried subclassing FigureCanvasWxAgg and defining key_press_event (which
doesn't seem to work) and overriding _onKeyDown (which still does not
capture the keys I need). Something weird seems to be happening to these
keys, and was wondering if anyone could help me?
I am able to detect the EVT_KEY_UP for these three keys. Just not the key
down ones. 
Thanks!
Orest
From: Emmanuel <emm...@fa...> - 2007年09月19日 20:33:44
With the setup you provided. I could get py2exe to make an exe of the
simple_plot.py from simple_plot_wxagg of py2exe examples.
When I tried this on another python prog, I remarked that if I comment the
following line :
import matplotlib.backends.backend_wxagg
the exe created by py2exe crash and the log tells us :
Traceback (most recent call last):
 File "entropia.py", line 6, in <module>
 File "pylab.pyo", line 1, in <module>
 File "matplotlib\pylab.pyo", line 222, in <module>
 File "matplotlib\backends\__init__.pyo", line 24, in pylab_setup
ImportError: No module named backend_wxagg
I think the same kind of problem may append with the default backend
tkagg...
From: Fabian B. <f.b...@gm...> - 2007年09月19日 19:28:40
Hi Jouni,
Jouni K. Seppänen schrieb am 09/16/2007 05:51 PM:
> Fabian Braennstroem <f.b...@gm...> writes:
> 
>> Lets say I have to columns, the I could use in a script:
>>
>> 	 res=plot(array_mapped[:,0],array_mapped[:,1], 'b',
>> array_mapped[:,0],array_mapped[:,2], 'g')
>>
>> The next time a have 5 columns in a file and want to plot all 5
>> columns without adjusting the 'plot' command in the script, but just
>> by defining an argument when starting the script.
> 
> Perhaps 'plot' is not the ideal interface for your purposes. How about
> something like this:
> 
> 
> 
> ------------------------------------------------------------------------
> 
> #!/usr/bin/env python
> 
> import matplotlib
> from matplotlib.lines import Line2D
> import pylab
> import numpy as npy
> 
> def myplot(ax, matrix, linestyle, color):
> for column in range(1, matrix.shape[1]):
> line = Line2D(matrix[:,0], matrix[:,column],
> linestyle=linestyle, color=color)
> ax.add_line(line)
> 
> colors = 'brk'
> 
> for d in range(2,5):
> fig=pylab.figure()
> ax=fig.add_subplot(111)
> matrix = npy.random.rand(d,d)
> matrix[:,0] = npy.linspace(0, 1, num=d)
> myplot(ax, matrix, '-', colors[d-2])
> 
> pylab.show()
Thanks for your help! add_line seems to be the right
function... I am not sure yet, if I need your function call,
but I will check it!?
Fabian
From: Mika, D. P (G. Research) <mi...@cr...> - 2007年09月19日 18:43:43
How about this solution? I'm a complete newbe, but this seems to do the =
trick. I didn't see a CircleCollection so I used CirclePolygon to =
generate vertices for a circle; these I grab and toss into a =
PolyCollection. Enjoy, Dave
import matplotlib
from matplotlib.patches import CirclePolygon from matplotlib.collections =
import PolyCollection import pylab=20
fig=3Dpylab.figure()
ax=3Dfig.add_subplot(111)=20
N =3D 20
x =3D pylab.rand(N)
y =3D pylab.rand(N)
radii =3D 0.1*pylab.rand(N)
colors =3D 100*pylab.rand(N)
verts =3D []
for x1,y1,r in zip(x, y, radii):
 circle =3D CirclePolygon((x1,y1), r)
 verts.append(circle.get_verts())
 =20
p =3D PolyCollection(verts, cmap=3Dmatplotlib.cm.jet)
p.set_array(pylab.array(colors))
ax.add_patch(p)
pylab.colorbar(p)
ax.axis('equal')
pylab.show()
-----Original Message-----
From: mat...@li... =
[mailto:mat...@li...] On Behalf Of =
Jouni K. Sepp=E4nen
Sent: Wednesday, September 19, 2007 11:03 AM
To: mat...@li...
Subject: Re: [Matplotlib-users] Drawing filled circles (discs)
sidimok <si...@gm...> writes:
> Well, let's take the one you've proposed the last time. How than can i =
> put a colorbar beside the plot?
Add in the imports
from matplotlib.colorbar import ColorbarBase, make_axes
and change the myscatter function to
def myscatter(ax, colormap, x, y, radii, colors):
 for x1,y1,r,c in zip(x, y, radii, colormap(colors)):
 ax.add_patch(Circle((x1,y1), r, fc=3Dc))
 cax, _ =3D make_axes(ax)
 ColorbarBase(cax, cmap=3Dcolormap)
A better solution is probably to implement a CircleCollection similarly =
to the other collections.
--
Jouni K. Sepp=E4nen
http://www.iki.fi/jks
-------------------------------------------------------------------------=
This SF.net email is sponsored by: Microsoft Defy all challenges. =
Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: <jk...@ik...> - 2007年09月19日 15:06:20
sidimok <si...@gm...> writes:
> Well, let's take the one you've proposed the last time. How than can i put a
> colorbar beside the plot?
Add in the imports
from matplotlib.colorbar import ColorbarBase, make_axes
and change the myscatter function to
def myscatter(ax, colormap, x, y, radii, colors):
 for x1,y1,r,c in zip(x, y, radii, colormap(colors)):
 ax.add_patch(Circle((x1,y1), r, fc=c))
 cax, _ = make_axes(ax)
 ColorbarBase(cax, cmap=colormap)
A better solution is probably to implement a CircleCollection similarly
to the other collections.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: sidimok <si...@gm...> - 2007年09月19日 13:46:39
Jouni K. Sepp=C3=A4nen wrote:
>=20
>=20
> It would help to give a complete example. ColorbarBase itself does not
> create a colorbar but is useful for drawing a colorbar in existing axes.
>=20
>=20
Well, let's take the one you've proposed the last time. How than can i put =
a
colorbar beside the plot?
#!/usr/bin/env python=20
import matplotlib=20
from matplotlib.patches import Circle=20
import pylab=20
def myscatter(ax, colormap, x, y, radii, colors):=20
 for x1,y1,r,c in zip(x, y, radii, colormap(colors)):=20
 ax.add_patch(Circle((x1,y1), r, fc=3Dc))=20
fig=3Dpylab.figure()=20
ax=3Dfig.add_subplot(111)=20
myscatter(ax, matplotlib.cm.jet,=20
 pylab.rand(20), pylab.rand(20), 0.1*pylab.rand(20),
pylab.rand(20))=20
ax.axis('equal')=20
pylab.show()
--=20
View this message in context: http://www.nabble.com/Drawing-filled-circles-=
%28discs%29-tf4441651.html#a12777776
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: <jk...@ik...> - 2007年09月19日 13:27:46
sidimok <si...@gm...> writes:
> It works just fine, however the colorbar I'm getting with the following
> commands is very tiny.
>
> norm = matplotlib.colors.Normalize(vmin=x[0], vmax=x[-1]) # just an example
> cb = matplotlib.colorbar.ColorbarBase(ax, cmap=matplotlib.cm.jet, norm=norm)
It would help to give a complete example. ColorbarBase itself does not
create a colorbar but is useful for drawing a colorbar in existing axes.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: sidimok <si...@gm...> - 2007年09月19日 12:04:30
Jouni K. Sepp=C3=A4nen wrote:
>=20
> sidimok <si...@gm...> writes:
>=20
>> I'm using matplotlib to draw (from matplotlib.Patches import Circle)
>> filled
>> circles (disks) from a formatted data file, and would give each disk a
>> color relative to a variable, as done by the "scatter" function.
>=20
> Here's one way to do it:
>=20
>=20
> #!/usr/bin/env python
>=20
> import matplotlib
> from matplotlib.patches import Circle
> import pylab
>=20
> def myscatter(ax, colormap, x, y, radii, colors):
> for x1,y1,r,c in zip(x, y, radii, colormap(colors)):
> ax.add_patch(Circle((x1,y1), r, fc=3Dc))
>=20
> fig=3Dpylab.figure()
> ax=3Dfig.add_subplot(111)
>=20
> myscatter(ax, matplotlib.cm.jet,=20
> pylab.rand(20), pylab.rand(20), 0.1*pylab.rand(20),
> pylab.rand(20))
>=20
> ax.axis('equal')
> pylab.show()
>=20
>=20
>=20
>=20
Hi!
It works just fine, however the colorbar I'm getting with the following
commands is very tiny.
norm =3D matplotlib.colors.Normalize(vmin=3Dx[0], vmax=3Dx[-1]) # just an e=
xample
cb =3D matplotlib.colorbar.ColorbarBase(ax, cmap=3Dmatplotlib.cm.jet, norm=
=3Dnorm)
Any idea?
Thanks guys.
--=20
View this message in context: http://www.nabble.com/Drawing-filled-circles-=
%28discs%29-tf4441651.html#a12776069
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Yo m. H. <miq...@gm...> - 2007年09月19日 08:55:25
Hi all!
I'm actually working with Matplotlib/Pylab Interface for making 2D plot. I
need to specify screen location where the frame will appear and I don't know
how. Supose a simple example like:
from pylab import *
t = arange(0.0,10,0.01)
s = 20*sin(2*pi*t)
c = 20*cos(2*pi*t)
figure(1)
plot(s)
figure(2)
plot(c)
show()
If I do it in this way, one frame is hidded behind the other one. How can I
modify frames attributes in order to change their position on the screen?
Thanks in advance,
Miquel

Showing 11 results of 11

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