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






Showing 12 results of 12

From: Justin M. <jn...@gm...> - 2010年10月08日 20:43:50
I just refactored some custom code to make use of
axes_grid1.ImageGrid, and I think I've come across a bug (see below).
It looks like the tick labelsize doesn't get passed properly to the
parasite axes.
I'm using Python2.6, matplotlib-1.0.0 release, and the Qt4Agg backend.
Also, I noticed that the Grid.__init__ super-class constructor isn't
called in the ImageGrid.__init__ constructor; should it be?
By way of feature request, I'd prefer to be able to specify share_x
and share_y in the constructor, but that's not available in ImageGrid,
only in Grid.
If there's agreement that this is bug, I'll file it on the sourceforge
tracker. Is this fixed in SVN, or does anyone have workaround, e.g.,
some way to convert 'x-small' to the correct integer size, or a
different method to call?
Thanks,
 Justin
========
from mpl_toolkits.axes_grid1 import ImageGrid
import pylab
import numpy
row_height = 10
fi = pylab.figure()
grid = ImageGrid(fi, 111, nrows_ncols=(5,1), share_all=False, label_mode='l')
for i in range(5):
 a = abs(numpy.random.randn(5,100))
 im = grid[i].imshow(a)
cb = grid.cbar_axes[0].colorbar(im)
for ax in grid.axes_all:
 ax.set_yticks([])
# oops - this only changes the lowest Axes formatting
grid.axes_llc.tick_params(direction='out', labelsize='x-small')
pylab.show()
# Now pan to the left a bit-- you'll see the large 0 from the 100 xtick_label
# Let's try explicitly setting all of the xtick sizes. Kablooie.
for ax in grid.axes_all:
  ax.tick_params(direction='out', labelsize='x-small')
---------------------------------------------------------------------------
TypeError                 Traceback (most recent call last)
/tmp/<ipython console> in <module>()
.../matplotlib/axes.pyc in tick_params(self, axis, **kwargs)
  2215       xkw.pop('labelleft', None)
  2216       xkw.pop('labelright', None)
-> 2217       self.xaxis.set_tick_params(**xkw)
  2218     if axis in ['y', 'both']:
  2219       ykw = dict(kwargs)
.../matplotlib/axis.pyc in set_tick_params(self, which, reset, **kw)
  795       if which == 'major' or which == 'both':
  796         for tick in self.majorTicks:
--> 797           tick._apply_params(**self._major_tick_kw)
  798       if which == 'minor' or which == 'both':
  799         for tick in self.minorTicks:
.../matplotlib/axis.pyc in _apply_params(self, **kw)
  274     if dirpad:
  275       self._base_pad = kw.pop('pad', self._base_pad)
--> 276       self.apply_tickdir(kw.pop('tickdir', self._tickdir))
  277       trans = self._get_text1_transform()[0]
  278       self.label1.set_transform(trans)
.../matplotlib/axis.pyc in apply_tickdir(self, tickdir)
  331     else:
  332       self._tickmarkers = (mlines.TICKDOWN, mlines.TICKUP)
--> 333       self._pad = self._base_pad + self._size
  334
  335
TypeError: unsupported operand type(s) for +: 'int' and 'str'
From: Russell E. O. <ro...@uw...> - 2010年10月08日 16:25:42
The Mac installer for matplotlib that I recently announced had a bug: a 
file in dateutil had bad permissions. I think I've finally got that 
straightened out and there's a new installer here:
<http://www.astro.washington.edu/users/rowen/python/>
My apologies for the error.
-- Russell
From: Tony S Yu <ts...@gm...> - 2010年10月08日 13:31:30
On Oct 8, 2010, at 6:52 AM, Waléria Antunes David wrote:
> I don't understand what you did, i'm reading error data from a file.
> 
> def gera_grafico(N=200, eps=1):
> 
> x = np.abs(np.random.randn(N))
> y = 10*np.log((30*x + 1.)**(0.5)) + 34 + eps * np.random.randn(N)
> yerr = eps * np.random.randn(N)
> 
> I don't understand what you did in this code
> 
> ??
> 
> Thanks,
> Waleria.
Hey Waleria,
That was just some code to make up fake data with roughly the same shape and range as the data you plotted. As I mentioned, I needed to put something there to run your code.
Where do you get an error? If it's from the code above, you can just replace it with your data. In any case, you don't need to use the code I pasted; just make the changes I suggested: Fix the number passed to majorLocator and remove (or fix the initialization of) majorFormatter.
-T
> 
> 
> On Thu, Oct 7, 2010 at 5:06 PM, Tony S Yu <ts...@gm...> wrote:
> 
> On Oct 7, 2010, at 3:38 PM, Waléria Antunes David wrote:
> 
>> Hi,
>> 
>> I did like the links below, but seeing as it was my chart.
>> 
>> See
>> 
>> My code: http://pastebin.com/KcjHAPLN
>> 
>> On Thu, Oct 7, 2010 at 3:08 PM, John Hunter <jd...@gm...> wrote:
>> On Thu, Oct 7, 2010 at 1:01 PM, Waléria Antunes David
>> <wal...@gm...> wrote:
>> > I need to know how do these vertical lines on the graph. See the picture,
>> > the lines circled.
>> 
>> We call these major and minor ticks. The major ticks are the taller
>> ones, the minor ticks are the smaller ones. Their location is
>> controlled by the major and minor Locator instances, and the text
>> printed beside them is controlled by the major and minor formatter.
>> 
>> See
>> 
>> http://matplotlib.sourceforge.net/examples/pylab_examples/major_minor_demo1.html
>> http://matplotlib.sourceforge.net/examples/pylab_examples/major_minor_demo2.html
>> 
>> and
>> 
>> http://matplotlib.sourceforge.net/search.html?q=codex+set_minor_locator
>> 
>> To control the tick properties themselves, see the Tick section in
>> 
>> http://matplotlib.sourceforge.net/users/artists.html
>> 
>> JDH
>> 
>> <graph.png>
> 
> As John mentioned, the major and minor ticks were the taller and shorter ticks, respectively. In your pasted example, you only change the minor ticks; by setting the majorLocator to same value as in the original example (i.e. 20), you only get the major tick at 0 because your data only goes to 1.5 (i.e. 20 is outside your plot range).
> 
> Also, the majorFormatter in the example is set to work with integers, but your major tick labels should be float values (since most of them are between 0 and 1). Thus, the majorFormatter code is unnecessary (commented out below).
> 
> Finally, a pet peeve: when posting example code, please make the effort to generate data for the plot so that others can easily run the code (see attached).
> 
> -Tony
> 
> #---
> 
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib.ticker import MultipleLocator, FormatStrFormatter
> 
> def gera_grafico(N=200, eps=1):
> 
> x = np.abs(np.random.randn(N))
> y = 10*np.log((30*x + 1.)**(0.5)) + 34 + eps * np.random.randn(N)
> yerr = eps * np.random.randn(N)
> 
> majorLocator = MultipleLocator(0.2)
> # majorFormatter = FormatStrFormatter('%d')
> minorLocator = MultipleLocator(0.02)
> 
> fig, ax = plt.subplots()
> plt.errorbar(x, y, yerr, fmt='ob', label='date')
> 
> plt.xlim(0.0, 1.5)
> #plt.xscale('log')
> #grid(True)
> 
> ax.xaxis.set_major_locator(majorLocator)
> # ax.xaxis.set_major_formatter(majorFormatter)
> 
> ax.xaxis.set_minor_locator(minorLocator)
> 
> return fig
> 
> if __name__ == '__main__':
> gera_grafico()
> plt.show()
> 
> 
> 
From: Sebastian B. <web...@th...> - 2010年10月08日 11:40:20
Attachments: signature.asc
hey pau,
ellipk is in scipy.special:
#!/usr/bin/env python
from pylab import *
from scipy.special import ellipk
e=1.
a_mpc = 4.0
p = a_mpc * (1 - e**2.)
Phase = 4.*sqrt(p/(p -6. - 2.*e)) * ellipk(-4.*e/(p - 6. -2.*e))
greetings,
sebastian.
From: Pau <vim...@go...> - 2010年10月08日 11:06:08
Hi,
I am trying to calculate a function with a complete elliptic integral
of the 1st kind
I have defined
Phase = 4.*sqrt(p/(p -6. - 2.*e)) * ellipk(-4.*e/(p - 6. -2.*e))
where
a_mpc = 4.0
p = a_mpc * (1 - e**2.)
and I have of course done this
#!/usr/bin/env python
from pylab import *
But when calling the script, I get:
NameError: name 'ellipk' is not defined
What am I doing wrong? Any help will be very much appreciated.
Thanks a lot,
Pau
From: Waléria A. D. <wal...@gm...> - 2010年10月08日 10:52:30
I don't understand what you did, i'm reading error data from a file.
def gera_grafico(N=200, eps=1):
 x = np.abs(np.random.randn(N))
 y = 10*np.log((30*x + 1.)**(0.5)) + 34 + eps * np.random.randn(N)
 yerr = eps * np.random.randn(N)
I don't understand what you did in this code
??
Thanks,
Waleria.
On Thu, Oct 7, 2010 at 5:06 PM, Tony S Yu <ts...@gm...> wrote:
>
> On Oct 7, 2010, at 3:38 PM, Waléria Antunes David wrote:
>
> Hi,
>
> I did like the links below, but seeing as it was my chart.
>
> See
>
> My code: http://pastebin.com/KcjHAPLN
>
> On Thu, Oct 7, 2010 at 3:08 PM, John Hunter <jd...@gm...> wrote:
>
>> On Thu, Oct 7, 2010 at 1:01 PM, Waléria Antunes David
>> <wal...@gm...> wrote:
>> > I need to know how do these vertical lines on the graph. See the
>> picture,
>> > the lines circled.
>>
>> We call these major and minor ticks. The major ticks are the taller
>> ones, the minor ticks are the smaller ones. Their location is
>> controlled by the major and minor Locator instances, and the text
>> printed beside them is controlled by the major and minor formatter.
>>
>> See
>>
>>
>> http://matplotlib.sourceforge.net/examples/pylab_examples/major_minor_demo1.html
>>
>> http://matplotlib.sourceforge.net/examples/pylab_examples/major_minor_demo2.html
>>
>> and
>>
>> http://matplotlib.sourceforge.net/search.html?q=codex+set_minor_locator
>>
>> To control the tick properties themselves, see the Tick section in
>>
>> http://matplotlib.sourceforge.net/users/artists.html
>>
>> JDH
>>
>
> <graph.png>
>
>
> As John mentioned, the major and minor ticks were the taller and shorter
> ticks, respectively. In your pasted example, you only change the minor
> ticks; by setting the majorLocator to same value as in the original example
> (i.e. 20), you only get the major tick at 0 because your data only goes to
> 1.5 (i.e. 20 is outside your plot range).
>
> Also, the majorFormatter in the example is set to work with integers, but
> your major tick labels should be float values (since most of them are
> between 0 and 1). Thus, the majorFormatter code is unnecessary (commented
> out below).
>
> Finally, a pet peeve: when posting example code, please make the effort to
> generate data for the plot so that others can easily run the code (see
> attached).
>
> -Tony
>
> #---
>
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib.ticker import MultipleLocator, FormatStrFormatter
>
> def gera_grafico(N=200, eps=1):
>
> x = np.abs(np.random.randn(N))
> y = 10*np.log((30*x + 1.)**(0.5)) + 34 + eps * np.random.randn(N)
> yerr = eps * np.random.randn(N)
>
> majorLocator = MultipleLocator(0.2)
> # majorFormatter = FormatStrFormatter('%d')
> minorLocator = MultipleLocator(0.02)
>
> fig, ax = plt.subplots()
> plt.errorbar(x, y, yerr, fmt='ob', label='date')
>
> plt.xlim(0.0, 1.5)
> #plt.xscale('log')
> #grid(True)
>
> ax.xaxis.set_major_locator(majorLocator)
> # ax.xaxis.set_major_formatter(majorFormatter)
>
> ax.xaxis.set_minor_locator(minorLocator)
>
> return fig
>
> if __name__ == '__main__':
> gera_grafico()
> plt.show()
>
>
>
From: Eric F. <ef...@ha...> - 2010年10月08日 05:47:28
On 10/07/2010 07:11 PM, Åke Kullenberg wrote:
> I am using Python 2.7 and Matplotlib 1.0.0 and I am having problems
> getting events triggering in this example below. I have taken the
> draggable rectangle example (with blit) code from the event handling
> documentation
> (http://matplotlib.sourceforge.net/users/event_handling.html) and tried
> to put it in a wxPython frame. The problem I have is that I can't get
> any events to register. When I click in the figure nothing happens, the
> on_press section in the code is never reached.
>
> Any suggestions how I can make this work?
Keep references to your DraggableRectangle objects. As it is you are 
putting them in a list, but the list and its contents are being 
garbage-collected as soon as TestFrame.__init__() finishes.
This was discussed recently on the list; I think you are the third 
person in the last week or two who has run into this consequence of a 
change that was made (for good reasons) in mpl 1.0.
Eric
>
> I have a vague recollection of this working in matplotlib < 1.0.0 and
> python < 2.7, but I am not 100% sure as it was a long time ago I last
> worked with matplotlib.
>
> The code:
>
> import numpy as np
> import wx
> from matplotlib.figure import Figure
> from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as
> FigureCanvas
>
> class DraggableRectangle:
> lock = None # only one can be animated at a time
> def __init__(self, rect):
> self.rect = rect
> self.press = None
> self.background = None
>
> def connect(self):
> 'connect to all the events we need'
> self.cidpress =
> self.rect.figure.canvas.mpl_connect('button_press_event', self.on_press)
> self.cidrelease =
> self.rect.figure.canvas.mpl_connect('button_release_event', self.on_release)
> self.cidmotion =
> self.rect.figure.canvas.mpl_connect('motion_notify_event', self.on_motion)
>
> def on_press(self, event):
> 'on button press we will see if the mouse is over us and store some data'
> if event.inaxes != self.rect.axes: return
> if DraggableRectangle.lock is not None: return
> contains, attrd = self.rect.contains(event)
> if not contains: return
> print 'event contains', self.rect.xy
> x0, y0 = self.rect.xy
> self.press = x0, y0, event.xdata, event.ydata
> DraggableRectangle.lock = self
>
> # draw everything but the selected rectangle and store the pixel buffer
> canvas = self.rect.figure.canvas
> axes = self.rect.axes
> self.rect.set_animated(True)
> canvas.draw()
> self.background = canvas.copy_from_bbox(self.rect.axes.bbox)
>
> # now redraw just the rectangle
> axes.draw_artist(self.rect)
>
> # and blit just the redrawn area
> canvas.blit(axes.bbox)
>
> def on_motion(self, event):
> 'on motion we will move the rect if the mouse is over us'
> if DraggableRectangle.lock is not self:
> return
> if event.inaxes != self.rect.axes: return
> x0, y0, xpress, ypress = self.press
> dx = event.xdata - xpress
> dy = event.ydata - ypress
> self.rect.set_x(x0+dx)
> self.rect.set_y(y0+dy)
>
> canvas = self.rect.figure.canvas
> axes = self.rect.axes
> # restore the background region
> canvas.restore_region(self.background)
>
> # redraw just the current rectangle
> axes.draw_artist(self.rect)
>
> # blit just the redrawn area
> canvas.blit(axes.bbox)
>
> def on_release(self, event):
> 'on release we reset the press data'
> if DraggableRectangle.lock is not self:
> return
>
> self.press = None
> DraggableRectangle.lock = None
>
> # turn off the rect animation property and reset the background
> self.rect.set_animated(False)
> self.background = None
>
> # redraw the full figure
> self.rect.figure.canvas.draw()
>
> def disconnect(self):
> 'disconnect all the stored connection ids'
> self.rect.figure.canvas.mpl_disconnect(self.cidpress)
> self.rect.figure.canvas.mpl_disconnect(self.cidrelease)
> self.rect.figure.canvas.mpl_disconnect(self.cidmotion)
>
> class TestFrame(wx.Frame):
> def __init__(self):
> wx.Frame.__init__(self, None, title="Event Test", size=(640,480))
> panel = wx.Panel(self,-1)
> fig = Figure()
> canvas = FigureCanvas(panel, -1, fig)
> ax = fig.add_subplot(111)
> rects = ax.bar(range(10), 20*np.random.rand(10))
> drs = []
> for rect in rects:
> dr = DraggableRectangle(rect)
> dr.connect()
> drs.append(dr)
> fig.canvas.draw()
>
> if __name__ == "__main__":
> app = wx.App()
> theFrame = TestFrame()
> theFrame.Show()
> app.MainLoop()
>
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Åke K. <ake...@gm...> - 2010年10月08日 05:11:35
I am using Python 2.7 and Matplotlib 1.0.0 and I am having problems getting
events triggering in this example below. I have taken the draggable
rectangle example (with blit) code from the event handling documentation (
http://matplotlib.sourceforge.net/users/event_handling.html) and tried to
put it in a wxPython frame. The problem I have is that I can't get any
events to register. When I click in the figure nothing happens, the
on_press section in the code is never reached.
Any suggestions how I can make this work?
I have a vague recollection of this working in matplotlib < 1.0.0 and python
< 2.7, but I am not 100% sure as it was a long time ago I last worked with
matplotlib.
The code:
import numpy as np
import wx
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as
FigureCanvas
class DraggableRectangle:
lock = None # only one can be animated at a time
def __init__(self, rect):
self.rect = rect
self.press = None
self.background = None
def connect(self):
'connect to all the events we need'
self.cidpress = self.rect.figure.canvas.mpl_connect('button_press_event',
self.on_press)
self.cidrelease =
self.rect.figure.canvas.mpl_connect('button_release_event', self.on_release)
self.cidmotion = self.rect.figure.canvas.mpl_connect('motion_notify_event',
self.on_motion)
def on_press(self, event):
'on button press we will see if the mouse is over us and store some data'
if event.inaxes != self.rect.axes: return
if DraggableRectangle.lock is not None: return
contains, attrd = self.rect.contains(event)
if not contains: return
print 'event contains', self.rect.xy
x0, y0 = self.rect.xy
self.press = x0, y0, event.xdata, event.ydata
DraggableRectangle.lock = self
# draw everything but the selected rectangle and store the pixel buffer
canvas = self.rect.figure.canvas
axes = self.rect.axes
self.rect.set_animated(True)
canvas.draw()
self.background = canvas.copy_from_bbox(self.rect.axes.bbox)
# now redraw just the rectangle
axes.draw_artist(self.rect)
# and blit just the redrawn area
canvas.blit(axes.bbox)
def on_motion(self, event):
'on motion we will move the rect if the mouse is over us'
if DraggableRectangle.lock is not self:
return
if event.inaxes != self.rect.axes: return
x0, y0, xpress, ypress = self.press
dx = event.xdata - xpress
dy = event.ydata - ypress
self.rect.set_x(x0+dx)
self.rect.set_y(y0+dy)
canvas = self.rect.figure.canvas
axes = self.rect.axes
# restore the background region
canvas.restore_region(self.background)
# redraw just the current rectangle
axes.draw_artist(self.rect)
# blit just the redrawn area
canvas.blit(axes.bbox)
def on_release(self, event):
'on release we reset the press data'
if DraggableRectangle.lock is not self:
return
self.press = None
DraggableRectangle.lock = None
# turn off the rect animation property and reset the background
self.rect.set_animated(False)
self.background = None
# redraw the full figure
self.rect.figure.canvas.draw()
def disconnect(self):
'disconnect all the stored connection ids'
self.rect.figure.canvas.mpl_disconnect(self.cidpress)
self.rect.figure.canvas.mpl_disconnect(self.cidrelease)
self.rect.figure.canvas.mpl_disconnect(self.cidmotion)
class TestFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Event Test", size=(640,480))
panel = wx.Panel(self,-1)
fig = Figure()
canvas = FigureCanvas(panel, -1, fig)
ax = fig.add_subplot(111)
rects = ax.bar(range(10), 20*np.random.rand(10))
drs = []
for rect in rects:
dr = DraggableRectangle(rect)
dr.connect()
drs.append(dr)
fig.canvas.draw()
if __name__ == "__main__":
app = wx.App()
theFrame = TestFrame()
theFrame.Show()
app.MainLoop()
From: Thomas R. <tho...@gm...> - 2010年10月08日 02:33:48
Hi,
I am using matplotlib with the MacOSX backend. If I run:
import matplotlib
matplotlib.use('MacOSX')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
the cursor coordinates are missing from the bottom right of the window. If I click on the figure, the coordinates sometimes appear, but only update when I click inside the axes, and even then only half of the time. Is this a known issue? Should I file a bug report?
I am using svn revision 8735
Thanks,
Thomas
From: Justin M. <jn...@gm...> - 2010年10月08日 02:31:11
On Thu, Oct 7, 2010 at 4:08 PM, Benjamin Root <ben...@ou...> wrote:
> ...
>> On Thu, Oct 7, 2010 at 3:09 PM, Justin McCann <jn...@gm...> wrote:
>>
>>> ...
>>
>> I'd like to annotate across all of the subplots by placing a vertical line
>>> (or vspan) across the entire figure-- to extend from the bottom figure all
>>> the way to the top, including the spaces in between. I thought I had seen an
>>> example of this somewhere, but couldn't find it in the gallery. Any
>>> suggestions?
>>
>>
>> You are right, I could have sworn I seen an example of that somewhere, but
> this is the best I could find:
>
>
> http://matplotlib.sourceforge.net/users/annotations_guide.html?highlight=annotation#using-connectorpatch
>
>
That works; thanks for the pointer.
From: Benjamin R. <ben...@ou...> - 2010年10月08日 01:46:03
On Thu, Oct 7, 2010 at 7:55 PM, Jacob Silterra <js...@gm...> wrote:
> Hello,
>
> The only backend which works on my machine is wx.
> The problem I was having was that matplotlib installed fine, but didn't
> show plots. I tried removing matplotlib and re-installing,
> that didn't help. I was using the Agg backend and figure windows did not
> get created. Cairo doesn't work either.
> I can live with only using wx, but
>
> On my machine, I test with the following script:
> from pylab import *
> ion()
> fig = figure()
> plot([1,2,3])
> show()
> fig.savefig('test.png')
>
> With agg, the figure saves correctly, but no window appears. With wx, a
> window with the plot appears. I'm running numpy 1.5.0 (also built from
> source).
>
> OS: Ubuntu 10.04
> uname output: Linux 2.6.32-25-generic-pae #44-Ubuntu SMP
> matplotlib version: 1.0.0
> verbose output of script above:
> matplotlib data path
> /usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data
> loaded rc file
> /usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data/matplotlibrc
> matplotlib version 1.0.0
> verbose.level helpful
> interactive is False
> units is False
> platform is linux2
> Using fontManager instance from .matplotlib/fontList.cache
> backend agg version v2.2
>
> basedirlist is: ['/usr/local', '/usr']
>
> ============================================================================
> BUILDING MATPLOTLIB
> matplotlib: 1.0.0
> python: 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC
> 4.4.3]
> platform: linux2
>
> REQUIRED DEPENDENCIES
> numpy: 1.5.0
> freetype2: 9.22.3
>
> OPTIONAL BACKEND DEPENDENCIES
> libpng: 1.2.42
> Tkinter: no
> * Using default library and include directories for
> * Tcl and Tk because a Tk window failed to open.
> * You may need to define DISPLAY for Tk to work so
> * that setup can determine where your libraries are
> * located. Tkinter present, but header files are
> not
> * found. You may need to install development
> * packages.
> wxPython: 2.8.10.1
> * WxAgg extension not required for wxPython >= 2.8
> pkg-config: looking for pygtk-2.0 gtk+-2.0
> * Package pygtk-2.0 was not found in the pkg-config
> * search path. Perhaps you should add the directory
> * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH
> * environment variable No package 'pygtk-2.0' found
> * You may need to install 'dev' package(s) to
> * provide header files.
> Gtk+: no
> * Could not find Gtk+ headers in any of
> * '/usr/local/include', '/usr/include', '.'
> Mac OS X native: no
> Qt: no
> Qt4: Qt: 4.6.2, PyQt4: 4.7.2
> Cairo: 1.8.8
>
> OPTIONAL DATE/TIMEZONE DEPENDENCIES
> datetime: present, version unknown
> dateutil: 1.4.1
> pytz: 2010b
>
> OPTIONAL USETEX DEPENDENCIES
> dvipng: no
> ghostscript: 8.71
> latex: no
> pdftops: 0.12.4
>
> [Edit setup.cfg to suppress the above messages]
>
> ============================================================================
> pymods ['pylab']
> packages ['matplotlib', 'matplotlib.backends',
> 'matplotlib.backends.qt4_editor', 'matplotlib.projections',
> 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests',
> 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid',
> 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist',
> 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', '
> matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra',
> 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft',
> 'matplotlib.tri', 'matplotlib.delaunay']
> running build
> running build_py
> copying lib/matplotlib/mpl-data/matplotlibrc ->
> build/lib.linux-i686-2.6/matplotlib/mpl-data
> copying lib/matplotlib/mpl-data/matplotlib.conf ->
> build/lib.linux-i686-2.6/matplotlib/mpl-data
> running build_ext
>
> -Jacob
>
>
Jacob,
It should be expected that using the Agg backend causes no figure window to
appear because Agg is meant for head-less environments like servers and
such. The reason no other backend seem available to you is that you do not
appear to have the appropriate development libraries available (except,
apparently the wx libraries... go figure).
Which Linux are you using? In Debian based systems, you can grab the build
dependencies for a package with a command like:
apt-get build-dep matplotlib
(or whatever the package name is on Ubuntu). The nice thing about this is
that it will download and install everything you need to build matplotlib,
but without downloading and installing matplotlib itself. Note that it will
install numpy, so if you have that manually installed, you will need to
work around that.
Ben Root
From: Jacob S. <js...@gm...> - 2010年10月08日 00:55:58
Hello,
The only backend which works on my machine is wx.
The problem I was having was that matplotlib installed fine, but didn't show
plots. I tried removing matplotlib and re-installing,
that didn't help. I was using the Agg backend and figure windows did not get
created. Cairo doesn't work either.
I can live with only using wx, but
On my machine, I test with the following script:
from pylab import *
ion()
fig = figure()
plot([1,2,3])
show()
fig.savefig('test.png')
With agg, the figure saves correctly, but no window appears. With wx, a
window with the plot appears. I'm running numpy 1.5.0 (also built from
source).
OS: Ubuntu 10.04
uname output: Linux 2.6.32-25-generic-pae #44-Ubuntu SMP
matplotlib version: 1.0.0
verbose output of script above:
matplotlib data path
/usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data
loaded rc file
/usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.0.0
verbose.level helpful
interactive is False
units is False
platform is linux2
Using fontManager instance from .matplotlib/fontList.cache
backend agg version v2.2
basedirlist is: ['/usr/local', '/usr']
============================================================================
BUILDING MATPLOTLIB
 matplotlib: 1.0.0
 python: 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC
 4.4.3]
 platform: linux2
REQUIRED DEPENDENCIES
 numpy: 1.5.0
 freetype2: 9.22.3
OPTIONAL BACKEND DEPENDENCIES
 libpng: 1.2.42
 Tkinter: no
 * Using default library and include directories for
 * Tcl and Tk because a Tk window failed to open.
 * You may need to define DISPLAY for Tk to work so
 * that setup can determine where your libraries are
 * located. Tkinter present, but header files are not
 * found. You may need to install development
 * packages.
 wxPython: 2.8.10.1
 * WxAgg extension not required for wxPython >= 2.8
 pkg-config: looking for pygtk-2.0 gtk+-2.0
 * Package pygtk-2.0 was not found in the pkg-config
 * search path. Perhaps you should add the directory
 * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH
 * environment variable No package 'pygtk-2.0' found
 * You may need to install 'dev' package(s) to
 * provide header files.
 Gtk+: no
 * Could not find Gtk+ headers in any of
 * '/usr/local/include', '/usr/include', '.'
 Mac OS X native: no
 Qt: no
 Qt4: Qt: 4.6.2, PyQt4: 4.7.2
 Cairo: 1.8.8
OPTIONAL DATE/TIMEZONE DEPENDENCIES
 datetime: present, version unknown
 dateutil: 1.4.1
 pytz: 2010b
OPTIONAL USETEX DEPENDENCIES
 dvipng: no
 ghostscript: 8.71
 latex: no
 pdftops: 0.12.4
[Edit setup.cfg to suppress the above messages]
============================================================================
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends',
'matplotlib.backends.qt4_editor', 'matplotlib.projections',
'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests',
'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid',
'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist',
'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', '
matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra',
'matplotlib.numerix.random_array', 'matplotlib.numerix.fft',
'matplotlib.tri', 'matplotlib.delaunay']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc ->
build/lib.linux-i686-2.6/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf ->
build/lib.linux-i686-2.6/matplotlib/mpl-data
running build_ext
-Jacob

Showing 12 results of 12

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