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





Showing results of 303

<< < 1 .. 9 10 11 12 13 > >> (Page 11 of 13)
From: fafcb <fas...@gm...> - 2010年05月07日 19:39:02
I'm new to matplotlib, so maybe this is obvious, but I've search quite a bit
and can't find the answer.
I have a data set with several hundred rows and about 5 columns. I want to
plot all data points (columns 2-5) on the same logarithmic chart with the x
axis showing calendar dates (column 1).
What is the best way to accomplish my task? I have been experimenting with
semilogy, but I can't seem to figure out how to get columns 2-5 to plot by
date. Just FYI, if it matters - the data is currently held in a csv file
and each column may or may not have a data point for each date.
Thanks in advance for any help!
From: Friedrich R. <fri...@gm...> - 2010年05月07日 19:06:44
2010年5月7日 Bartosz Telenczuk <bar...@gm...>:
> Dear all,
>
> I am working on figures for my thesis, which consist of several related
panels. Each of the panel contains several subplots. In order to arrange the
plots I would like to split the figure into two (or more) panels and within
each of them create a nested set of subplots. Optimally, the main panels
should define their own coordinate systems, such that all of the nested
subplot positions are defined within their frame. The syntax could look like
that:
>
> panel1 = subplot(1,2,1)
> panel2 = subplot(1,2,2)
>
> ax1 = panel1.add_subplot(1,2,1)
> ax2 = panel1.add_subplot(1,2,2)
>
> ax3 = panel2.add_subplot(111)
I think what you could maybe try is to write a class using figure.add_axes()
http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.add_axes
The class could store a relative area and a "master". For the panels you
need, the master would be the Figure. Such a Panel class could expose an
add_axes() method too, but forwarding the call to its master. To calculate
the *rect* argument when callings its master's .add_axes(), it would use a
linear transformation from the stored extent to the (0, 1) extent relative
to the master. Let it be depicted:
+----------------------+ Figure
 +-------------+ Panel
 +------+ Axes
There could be more Panels in between. You would do:
>>> panel = Panel(figure, (0.2, 0.6)) # left = 0.2, width = 0.6, i.e. right
= 0.8
>>> axes = panel.add_axes((0, 0.5)) # left = 0, width = 0.5, i.e. right =
0.5
The last call would do:
1) Transform the (0, 0.5) to the Figure reference frame (more precise, to
the master ref frame, where by coincidence the Figure is the master). Thie
yields here (0.2, 0.3) = (left, width), i.e. right = 0.5 (in the master ref
frame).
2) Call master.add_axes((0.2, 0.3)). This actually creates the Axes
instance by recusions until the master is a Figure.
I think this approach is feasible in < 200 loc.
hth
Friedrich
From: John H. <jd...@gm...> - 2010年05月07日 18:22:58
On Fri, May 7, 2010 at 1:09 PM, Eric Firing <ef...@ha...> wrote:
> On 05/06/2010 08:02 PM, oyster wrote:
>> I know matplotlib mimics matlab, which offers scientific look.
>> but can we use matplotlib to get a skecth(in other words,
>> hand-drawing) style for bar/pie/etc in none formalist paper? for
>> example, http://teethgrinder.co.uk/open-flash-chart/gallery-bar-7.php
>> thanks
>
> With a considerable effort you could use mpl's capabilities to program
> this sort of thing, but it will not be added as an option.
JJ's demo_ribbon_box is pretty close -- you just need to create a base
image you want stretched to the bar height.
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.image import BboxImage
from matplotlib._png import read_png
import matplotlib.colors
from matplotlib.cbook import get_sample_data
class RibbonBox(object):
 original_image = read_png(get_sample_data("Minduka_Present_Blue_Pack.png",
 asfileobj=False))
 cut_location = 70
 b_and_h = original_image[:,:,2]
 color = original_image[:,:,2] - original_image[:,:,0]
 alpha = original_image[:,:,3]
 nx = original_image.shape[1]
 def __init__(self, color):
 rgb = matplotlib.colors.colorConverter.to_rgb(color)
 im = np.empty(self.original_image.shape,
 self.original_image.dtype)
 im[:,:,:3] = self.b_and_h[:,:,np.newaxis]
 im[:,:,:3] -= self.color[:,:,np.newaxis]*(1.-np.array(rgb))
 im[:,:,3] = self.alpha
 self.im = im
 def get_stretched_image(self, stretch_factor):
 stretch_factor = max(stretch_factor, 1)
 ny, nx, nch = self.im.shape
 ny2 = int(ny*stretch_factor)
 stretched_image = np.empty((ny2, nx, nch),
 self.im.dtype)
 cut = self.im[self.cut_location,:,:]
 stretched_image[:,:,:] = cut
 stretched_image[:self.cut_location,:,:] = \
 self.im[:self.cut_location,:,:]
 stretched_image[-(ny-self.cut_location):,:,:] = \
 self.im[-(ny-self.cut_location):,:,:]
 self._cached_im = stretched_image
 return stretched_image
class RibbonBoxImage(BboxImage):
 zorder = 1
 def __init__(self, bbox, color,
 cmap = None,
 norm = None,
 interpolation=None,
 origin=None,
 filternorm=1,
 filterrad=4.0,
 resample = False,
 **kwargs
 ):
 BboxImage.__init__(self, bbox,
 cmap = cmap,
 norm = norm,
 interpolation=interpolation,
 origin=origin,
 filternorm=filternorm,
 filterrad=filterrad,
 resample = resample,
 **kwargs
 )
 self._ribbonbox = RibbonBox(color)
 self._cached_ny = None
 def draw(self, renderer, *args, **kwargs):
 bbox = self.get_window_extent(renderer)
 stretch_factor = bbox.height / bbox.width
 ny = int(stretch_factor*self._ribbonbox.nx)
 if self._cached_ny != ny:
 arr = self._ribbonbox.get_stretched_image(stretch_factor)
 self.set_array(arr)
 self._cached_ny = ny
 BboxImage.draw(self, renderer, *args, **kwargs)
if 1:
 from matplotlib.transforms import Bbox, TransformedBbox
 from matplotlib.ticker import ScalarFormatter
 fig = plt.gcf()
 fig.clf()
 ax = plt.subplot(111)
 years = np.arange(2004, 2009)
 box_colors = [(0.8, 0.2, 0.2),
 (0.2, 0.8, 0.2),
 (0.2, 0.2, 0.8),
 (0.7, 0.5, 0.8),
 (0.3, 0.8, 0.7),
 ]
 heights = np.random.random(years.shape) * 7000 + 3000
 fmt = ScalarFormatter(useOffset=False)
 ax.xaxis.set_major_formatter(fmt)
 for year, h, bc in zip(years, heights, box_colors):
 bbox0 = Bbox.from_extents(year-0.4, 0., year+0.4, h)
 bbox = TransformedBbox(bbox0, ax.transData)
 rb_patch = RibbonBoxImage(bbox, bc, interpolation="bicubic")
 ax.add_artist(rb_patch)
 ax.annotate(r"%d" % (int(h/100.)*100),
 (year, h), va="bottom", ha="center")
 patch_gradient = BboxImage(ax.bbox,
 interpolation="bicubic",
 zorder=0.1,
 )
 gradient = np.zeros((2, 2, 4), dtype=np.float)
 gradient[:,:,:3] = [1, 1, 0.]
 gradient[:,:,3] = [[0.1, 0.3],[0.3, 0.5]] # alpha channel
 patch_gradient.set_array(gradient)
 ax.add_artist(patch_gradient)
 ax.set_xlim(years[0]-0.5, years[-1]+0.5)
 ax.set_ylim(0, 10000)
 fig.savefig('ribbon_box.png')
 plt.show()
From: Eric F. <ef...@ha...> - 2010年05月07日 18:09:21
On 05/06/2010 08:02 PM, oyster wrote:
> I know matplotlib mimics matlab, which offers scientific look.
> but can we use matplotlib to get a skecth(in other words,
> hand-drawing) style for bar/pie/etc in none formalist paper? for
> example, http://teethgrinder.co.uk/open-flash-chart/gallery-bar-7.php
> thanks
With a considerable effort you could use mpl's capabilities to program 
this sort of thing, but it will not be added as an option.
Eric
From: Ryan M. <rm...@gm...> - 2010年05月07日 16:54:03
On Wed, May 5, 2010 at 4:36 PM, Valentino Gonzalez <vgg...@uc...> wrote:
> I am trying to make a scatter plot (it is important that it is a scatter
> plot because I want the markers to be color coded). Each point also has
> errobars associated and since there is no way to plot errorbars on scatter
> plots I am plotting them separately, i.e. plot twice: once with the
> errorbars and no markers and then with only markers as in a scatter plot.
> The problem is that regardless of the order in which I do this, the
> errorbars are alwas on top of the markers of the scatter plot and I would
> like the opposite, markers on top of the errorbars. Can this be done? And
> more generally, how can I choose what goes on top of what?
You should be able to pass zorder=<number> to the plotting functions
to control the order.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Matt N. <new...@ca...> - 2010年05月07日 16:07:27
Hi Soren,
2010年5月6日 Søren Nielsen <sor...@gm...>:
> Thanks Matt,
>
> The wx.ReleaseMouse() event when called before the wx.MessageBox also works
> great.
>
> I have a similar problem when I want to make a popup menu after the user has
> clicked on a patch (through the pick event) .. it works on Windows but the
> popup menu doesn't show on Linux (or only shows in rare occasions) . A
> wx.ReleaseMouse() doesn't seem to work here.. I've made a sample script that
> shows the problem. It doesn't use the pick event, but the same problem
> applies when using the button_press_event. If I want to go through the pick
> event then of course the button_release_event workaround doesn't work
> either.
>
> Also, clicking the right and left button like crazy to make the popup menu
> show on linux can result in the error:
>
> Traceback (most recent call last):
>  File
> "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_wx.py", line
> 1218, in _onKeyDown
>   FigureCanvasBase.key_press_event(self, key, guiEvent=evt)
>  File "/usr/lib64/python2.6/site-packages/matplotlib/backend_bases.py",
> line 1142, in key_press_event
>   event = KeyEvent(s, self, key, self._lastx, self._lasty,
> guiEvent=guiEvent)
>  File "/usr/lib64/python2.6/site-packages/matplotlib/backend_bases.py",
> line 970, in __init__
>   LocationEvent.__init__(self, name, canvas, x, y, guiEvent=guiEvent)
>  File "/usr/lib64/python2.6/site-packages/matplotlib/backend_bases.py",
> line 813, in __init__
>   axes_list = [a for a in self.canvas.figure.get_axes() if
> a.in_axes(self)]
>  File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 1538,
> in in_axes
>   return self.patch.contains(mouseevent)[0]
>  File "/usr/lib64/python2.6/site-packages/matplotlib/patches.py", line 501,
> in contains
>   x, y = self.get_transform().inverted().transform_point(
>  File "/usr/lib64/python2.6/site-packages/matplotlib/patches.py", line 119,
> in get_transform
>   return self.get_patch_transform() + artist.Artist.get_transform(self)
>  File "/usr/lib64/python2.6/site-packages/matplotlib/transforms.py", line
> 1033, in __add__
>   return composite_transform_factory(self, other)
>  File "/usr/lib64/python2.6/site-packages/matplotlib/transforms.py", line
> 2004, in composite_transform_factory
>   return CompositeAffine2D(a, b)
>  File "/usr/lib64/python2.6/site-packages/matplotlib/transforms.py", line
> 1964, in __init__
>   Affine2DBase.__init__(self)
>  File "/usr/lib64/python2.6/site-packages/matplotlib/transforms.py", line
> 1304, in __init__
>   Transform.__init__(self)
>  File "/usr/lib64/python2.6/site-packages/matplotlib/transforms.py", line
> 87, in __init__
>   self._parents = WeakKeyDictionary()
>  File "/usr/lib64/python2.6/weakref.py", line 232, in __init__
>   def remove(k, selfref=ref(self)):
> RuntimeError: maximum recursion depth exceeded while calling a Python object
I don't see that error, but perhaps I didn't emulate "click like
crazy" well enough.
I also see that trying to get a Popup Menu on Linux from events
generated by mpl does not reliably display a menu. In my experience,
a work-around is to replace a direct call to
 wx.Popup(menu)
with
 wx.CallAfter(wx.Popup, menu)
I don't know if this is related to the problem described earlier, in
which the wx object containing the FigureCanvasWxAgg needs to call
ReleaseMouse() on Linux but not Windows. As I said earlier, I have
not investigated very thoroughly so am reluctant to jump to any
conclusions about where the problem really lies and what the best
solution is.
An example with a Popup Menu that displays on right- or left-click of
a FigureCanvasWxAgg is below.
Cheers,
--Matt Newville
#!/usr/bin/python
import wx
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.figure import Figure
class PlotFrame(wx.Frame):
 def __init__(self, title='Plot Frame', **kwds):
 wx.Frame.__init__(self, None, -1, title=title, **kwds)
 self.panel = wx.Panel(self, -1,size=(600,500))
 self.fig = Figure()
 self.canvas = FigureCanvasWxAgg(self.panel, -1, self.fig)
 self.fig.add_subplot(111)
 self.canvas.mpl_connect('button_press_event',
 self.onMouseButtonClick)
 sizer = wx.BoxSizer(wx.VERTICAL)
 sizer.Add(self.canvas, 1, wx.LEFT |wx.TOP | wx.GROW)
 self.panel.SetSizer(sizer)
 self.SetAutoLayout(True)
 self.Fit()
 def onMouseButtonClick(self, event=None):
 if event is None:
 return
 if event.inaxes:
 menu = wx.Menu()
 if event.button == 1:
 menu.Append(1, 'Left Click: Set as Background file')
 self.Bind(wx.EVT_MENU, self.onSelect1)
 elif event.button == 3:
 menu.Append(1, 'RightClick: Do something else')
 self.Bind(wx.EVT_MENU, self.onSelect2)
 wx.CallAfter(self.PopupMenu, menu)
 def onSelect1(self, event=None):
 print 'select 1'
 def onSelect2(self, event=None):
 print 'select 2'
if __name__ == '__main__':
 app = wx.PySimpleApp()
 frame = PlotFrame(title='Test')
 frame.Show()
 frame.Raise()
 app.MainLoop()
From: Bartosz T. <bar...@gm...> - 2010年05月07日 10:23:40
Dear all,
I am working on figures for my thesis, which consist of several related panels. Each of the panel contains several subplots. In order to arrange the plots I would like to split the figure into two (or more) panels and within each of them create a nested set of subplots. Optimally, the main panels should define their own coordinate systems, such that all of the nested subplot positions are defined within their frame. The syntax could look like that:
panel1 = subplot(1,2,1)
panel2 = subplot(1,2,2)
ax1 = panel1.add_subplot(1,2,1)
ax2 = panel1.add_subplot(1,2,2)
ax3 = panel2.add_subplot(111)
For now it is not possible, because panel1 and panel2 are Axes instances which do not have add_subplot method. The only solution I am aware of is to define all of the subplots by hand using subplot or axes function with positions defined within whole figure coordinate system:
fig = figure()
ax1 = fig.add_subplot(2,2,1)
ax2 = fig.add_subplot(2,2,3)
ax3 = fig.add_subplot(1,2,2)
This is of course more difficult, less flexible and requires the user to decide in advance on the layout of the panel. 
Until now I exported each figure to SVG file and arranged them in one file using SVG directives. I also started implementing my own Multipanel class for matplotlib, but it proved out to be not so easy. Therefore I would like to ask if someone has implemented a similar approach or could give me some hints on the implementation.
I will be very grateful for any help.
Cheers,
Bartek
From: oyster <lep...@gm...> - 2010年05月07日 06:02:14
I know matplotlib mimics matlab, which offers scientific look.
but can we use matplotlib to get a skecth(in other words,
hand-drawing) style for bar/pie/etc in none formalist paper? for
example, http://teethgrinder.co.uk/open-flash-chart/gallery-bar-7.php
thanks
From: Michael H. <mh...@ge...> - 2010年05月07日 04:37:36
Hi All,
I am having trouble converting some histogram (hist) code written for an 
earlier version of matplotlib.
It uses the "width" keyword to set up fixed-width bins. However, I can't 
seem to recreate the exact plots, which is what I am trying to do - and 
the new rwidth parameter appears to be of no help, as it only allows me 
to set a scale factor.
Should I be using bins = [...] instead? If yes, has anyway tried 
converting bin widths from pre-rwidth versions of matplotlib before?
Many thanks,
Michael
From: Valentino G. <vgg...@uc...> - 2010年05月05日 22:37:42
I am trying to make a scatter plot (it is important that it is a scatter 
plot because I want the markers to be color coded). Each point also has 
errobars associated and since there is no way to plot errorbars on 
scatter plots I am plotting them separately, i.e. plot twice: once with 
the errorbars and no markers and then with only markers as in a scatter 
plot. 
The problem is that regardless of the order in which I do this, the 
errorbars are alwas on top of the markers of the scatter plot and I 
would like the opposite, markers on top of the errorbars. Can this be 
done? And more generally, how can I choose what goes on top of what?
Thanks,
Valentino.-
From: Jouni K. S. <jk...@ik...> - 2010年05月05日 15:16:19
"ai...@gm..." <ai...@gm...> writes:
> I have strange problem while I am importing matplotlib.
> File "/usr/lib/python2.6/xml/sax/saxutils.py", line 6, in <module>
> import os, urlparse, urllib, types
> File "/usr/lib/python2.6/urllib.py", line 26, in <module>
> import socket
> File "socket.py", line 7, in <module>
> except socket.error:
> AttributeError: 'module' object has no attribute 'error'
Note how Python prints the full path of saxutils.py and urllib.py but a
bare filename for socket.py. You probably have a file named socket.py in
your current working directory that is inadvertently getting imported by
urllib.py.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Alan G I. <ala...@gm...> - 2010年05月05日 13:44:10
On 5/5/2010 6:53 AM, Kim Hansen wrote:
> Could anyone give a working example of an embedded, animated plot in a
> Tkinter application, where animated=True is used together with canvas
> background copying to make efficient animated plots in Tkinter
> together with other widgets?
First see the embedding_in_tk.py example.
Then, for a simple example, you can see TSPlot here:
http://econpy.googlecode.com/svn/trunk/abm/gridworld/gridworld.py
You can stick it in any frame.
For a more complex example see diagram_cl
http://www.friedrichromstedt.org/index.php?m=186
hth,
Alan Isaac
From: KrishnaPribadi <Kri...@ha...> - 2010年05月05日 13:12:43
Ryan May-3 wrote:
> 
> 
> You can accomplish it by:
> 
> ax.texts.remove(arrow)
> 
> I'd still like to know why this exception gets raised:
> 
> 
> NotImplementedError Traceback (most recent call
> last)
> 
> /home/rmay/<ipython console> in <module>()
> 
> /home/rmay/.local/lib/python2.6/site-packages/matplotlib/artist.pyc in
> remove(self)
> 123 self._remove_method(self)
> 124 else:
> --> 125 raise NotImplementedError('cannot remove artist')
> 126 # TODO: the fix for the collections relim problem is to
> move the
> 
> 127 # limits calculation into the artist itself, including
> the property
> 
> 
> NotImplementedError: cannot remove artist
> 
> JJ, thoughts?
> 
> Ryan
> 
> -- 
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
Ryan,
I implemented this code fine and NEVER got any raised exceptions... Maybe
you did something else wrong?
-----
Krishna Adrianto Pribadi
Test Engineer
Harley-Davidson Motor Co.
Talladega Test Facility
Vehicle Test Stands
-- 
View this message in context: http://old.nabble.com/remove---delete-arrow---annotate%2C-how-to--tp28451836p28460643.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Trying to build matplotlib as given in the subject:
matplotlib 0.99.1.2
with:
freetype 2.3.12 (installed by standard procedure)
libpng 1.4.1 (installed by standard procedure)
on:
Mac OS X 10.6 (Snow Leopard) with Xcode 3.2.1 installed
fails according to
http://stackoverflow.com/questions/2442335/libpng-boostgil-png-infopp-null-not-found
because there seems to be some not-backward compatible API change from
libpng 1.2 => 1.4. The error I get is the same as reported under this
URL. The log is attached as setup-build.log.
Also I attach setup-config.log which shows only configuration result
and the modified setupext.py, modified such that freetype2 and libpng
are found on my darwin Mac OS X 10.6. The changes are marked by my
name Friedrich.
I think I can fix this as given under the URL above and a workaround
would probably be to revert to libpng 1.2 but I think this isn't the
perfect solution either ...
I also noticed that the buildbot is failing currently, is this normal behaviour?
I found no such issue on the list, I'm reading since Feb 22 and libpng
1.4 was released Feb 25 according to
http://www.libpng.org/pub/png/src/libpng-1.4.1-README.txt .
Friedrich
From: Kim H. <sla...@gm...> - 2010年05月05日 10:54:06
Hi,
Could anyone give a working example of an embedded, animated plot in a
Tkinter application, where animated=True is used together with canvas
background copying to make efficient animated plots in Tkinter
together with other widgets?
I cannot make it work myself, see below.
I am working on a prototype, where have some Tkinter widgets to
control what is plotted. What I want to plot is something which
progress in time depending on the state of the widgets, and it is
potentially a lot of graphs and details on the canvas, but only minor
changes between updates. So I would rather avoid redrawing the whole
canvas.
I would therefore like to use the trick with copying the backgorund,
static canvas from frame to frame to a buffer, and only draw the
animated artists on top of it as is discussed in
http://www.scipy.org/Cookbook/Matplotlib/Animations#head-3d51654b8306b1585664e7fe060a60fc76e5aa08
and also examplified in
http://matplotlib.sourceforge.net/examples/animation/animation_blit_tk.html
Now, the example does not embed the matplotlib canvas in a Tkinter
root class, which I need if I want to add other Tk widgets on the same
window
I have therefore tried to modify the animation by merging in the
embbedding in Tk example:
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk.html
The closest I have gotten to something, which works is this:
import matplotlib
matplotlib.use('TkAgg')
import Tkinter
import sys
import pylab as p
import numpy as npy
import time
root = Tkinter.Tk()
fig = matplotlib.figure.Figure()
ax = fig.add_subplot(111)
canvas = matplotlib.backends.backend_tkagg.FigureCanvasTkAgg(fig, root)
canvas.get_tk_widget().grid()
# create the initial line
x = npy.arange(0,2*npy.pi,0.01)
ax.grid(True)
# canvas.show() #If I add this, it does not show anything?
line, = ax.plot(x, npy.sin(x), animated=True, lw=2)
def run(*args):
 background = canvas.copy_from_bbox(ax.bbox)
 # for profiling
 tstart = time.time()
 while 1:
 # restore the clean slate background
 canvas.restore_region(background)
 # update the data
 line.set_ydata(npy.sin(x+run.cnt/10.0))
 # just draw the animated artist
 ax.draw_artist(line)
 # just redraw the axes rectangle
 canvas.blit(ax.bbox)
 if run.cnt==1000:
 # print the timing info and quit
 print 'FPS:' , 1000/(time.time()-tstart)
 sys.exit()
 run.cnt += 1
run.cnt = 0
manager = p.get_current_fig_manager()
manager.window.after(100, run)
p.show() # If I outcomment this, the graph does not animate
Now, this does show an efficient animated plot embedded in a Tk
application, but I cannot make it work witout instatiating the other
annoying backgroud window, whcih pops up when the p.show() is done.
However, if i uncomment it, I never get a visible window.
As I have understood the cookbook, one should draw the canvas before
copying it to the background and before drawing the animated Artists.
However, if I do that it does not work either.
I must admit, that I do not fully grasp waht is goin on in the lines,
where the current figure manager is associated woth the run method.
Another problem with the naimation is that it is not possible to close
it nicely.
Any help would be appreciated.
Kim
From: <ai...@gm...> - 2010年05月04日 22:41:05
I have strange problem while I am importing matplotlib.
When I try with python console I get:
ailpein@crane:~/programming/python$ python
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import matplotlib
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/lib/pymodules/python2.6/matplotlib/__init__.py", line 129, 
in <module>
 from rcsetup import defaultParams, validate_backend, validate_toolbar
 File "/usr/lib/pymodules/python2.6/matplotlib/rcsetup.py", line 18, in 
<module>
 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
 File "/usr/lib/pymodules/python2.6/matplotlib/fontconfig_pattern.py", 
line 23, in <module>
 from matplotlib.pyparsing import Literal, ZeroOrMore, \
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line 71, 
in <module>
 import xml.sax.saxutils
 File "/usr/lib/python2.6/xml/sax/saxutils.py", line 6, in <module>
 import os, urlparse, urllib, types
 File "/usr/lib/python2.6/urllib.py", line 26, in <module>
 import socket
 File "socket.py", line 7, in <module>
 except socket.error:
AttributeError: 'module' object has no attribute 'error'
Error in sys.excepthook:
Traceback (most recent call last):
 File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 
39, in apport_excepthook
 from apport.packaging_impl import impl as packaging
 File "/usr/lib/python2.6/dist-packages/apport/__init__.py", line 1, in 
<module>
 from apport.report import Report
 File "/usr/lib/python2.6/dist-packages/apport/report.py", line 14, in 
<module>
 import subprocess, tempfile, os.path, urllib, re, pwd, grp, os, sys
 File "/usr/lib/python2.6/urllib.py", line 26, in <module>
 import socket
 File "socket.py", line 7, in <module>
 except socket.error:
AttributeError: 'module' object has no attribute 'error'
Original exception was:
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/lib/pymodules/python2.6/matplotlib/__init__.py", line 129, 
in <module>
 from rcsetup import defaultParams, validate_backend, validate_toolbar
 File "/usr/lib/pymodules/python2.6/matplotlib/rcsetup.py", line 18, in 
<module>
 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
 File "/usr/lib/pymodules/python2.6/matplotlib/fontconfig_pattern.py", 
line 23, in <module>
 from matplotlib.pyparsing import Literal, ZeroOrMore, \
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line 71, 
in <module>
 import xml.sax.saxutils
 File "/usr/lib/python2.6/xml/sax/saxutils.py", line 6, in <module>
 import os, urlparse, urllib, types
 File "/usr/lib/python2.6/urllib.py", line 26, in <module>
 import socket
 File "socket.py", line 7, in <module>
 except socket.error:
AttributeError: 'module' object has no attribute 'error'
But when i try with ipython, then everything is OK.
ailpein@crane:~/programming/python$ ipython
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
Type "copyright", "credits" or "license" for more information.
IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: import matplotlib
In [2]:
Could anyone explain me how to fix that?
Thank You in advance.
B. Krajnik
From: Jeff W. <js...@fa...> - 2010年05月04日 22:36:21
On 5/4/10 4:25 PM, Timothy W. Hilton wrote:
> Hi Jeff,
>
> Thanks very much for your response. As you noted, I do not understand
> the Basemap global sinusoidal coordinate system. Does this statement
> not set up a global sinusoidal cartesian coordinate system centered at
> (lon = 0.0, lat = 0.0)?
> 
Tim: It's a global sinusoidal projection, but x=0,y=0 is not at 
lon_0,lat_0.
 >> from mpl_toolkits.basemap import Basemap
 >> m = Basemap(projection='sinu', resolution=None, lon_0=0.0, lat_0=0.0)
 >> print m(0,0,inverse=True)
(-176.20919036912957, -89.999999999808395)
I forget why I did it this way, but I think it has to do with the fact 
that the matplotlib coordinate system has 0,0 in the lower left corner, 
not the middle.
At any rate, apply a offset to x and y to map to your global coordinate 
system.
-Jeff
> m = Basemap(projection='sinu', resolution=None, lon_0=0.0, lat_0=0.0)
>
> If so, I would expect m(0.0, 0.0) to return (0.0, 0.0) and m(0.0, 0.0,
> inverse=True) to return (0.0, 0.0). Instead, I get:
> 
>>>> m(0.0,0.0)
>>>> 
> (20015077.371199999, 10007538.6856)
> 
>>>> m(0.0,0.0,inverse=True)
>>>> 
> (-176.20919036912957, -89.999999999808395)
>
> Sorry if I am being obtuse. Many thanks for your help.
>
> -Tim
>
> On Tue, May 2010, 04 at 04:01:21PM -0600, Jeff Whitaker wrote:
> 
>> On 5/4/10 2:03 PM, Timothy W. Hilton wrote:
>> 
>>> Hello matplotlib users,
>>>
>>> I am having trouble understanding the coordinate transformations in
>>> Basemap and pyproj. I have gridded MODIS vegetation data, with upper
>>> left corner and lower right corner given in projection coordinates
>>> (meters). I want to contour the data with Basemap. The data are in a
>>> sinusoidal projection, but the coordinates do not correspond to what
>>> Basemap seems to expect.
>>>
>>> The code below illustrates the problem. Proj translates the upper
>>> left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
>>> while Basemap does not.
>>>
>>> #-------- code --------
>>> 
>> >from mpl_toolkits.basemap import Basemap
>> >from mpl_toolkits.basemap import pyproj
>> 
>>> ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
>>> lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
>>>
>>> sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
>>> m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
>>>
>>> print "ULM: " + str(ulm)
>>> print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
>>> print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
>>> #----- end code --------
>>>
>>> This gives:
>>> ULM: [-8895604.1573329996, 3335851.5589999999]
>>> Proj: (-92.327237416031437, 30.141972433747089)
>>> Basemap: (-159.99950210056144, -59.99995206181125)
>>>
>>> I'm sure I'm missing something really simple, but I've read a lot of
>>> documentation and I'm not sure what.
>>>
>>> Many thanks for any help.
>>>
>>> Best,
>>> Tim
>>> 
>> Tim: Basemap is using pyproj under the hood, but only supports a
>> subset of possible proj4 projections. The basemap sinusoidal
>> projection is global - you can't specify a subregion of the globe.
>> I think that's where the discrepancy is coming from. I'm sure
>> there's a way to plot your MODIS data on a global sinusoidal
>> projection - but it will involve transforming the coordinates to the
>> Basemap global sinuosidal coordinate system.
>>
>> -Jeff
>>
>> 
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Nico S. <nic...@gm...> - 2010年05月04日 22:27:39
This is weird:
When plotting something very simple, e.g.,
 t = arange( 0.0, 2.0, 0.01 )
 s = sin( 2*pi*t )
 plot( t, s, ":" )
I thought I can check weather the grid is on or off by
 gca().get_xgridlines()
-- but this *always* returns
<a list of 5 Line2D xgridline objects>
with *always* the same lines
Line2D((0,0),(0,1))
Line2D((0,0),(0,1))
Line2D((0,0),(0,1))
Line2D((0,0),(0,1))
Line2D((0,0),(0,1))
That's really independent of whether the grid is on or off.
Is there any explanation for it that does not have to do with Harry
Potter or the Jedi? ;)
--Nico
From: Timothy W. H. <hi...@me...> - 2010年05月04日 22:26:33
Hi Jeff,
Thanks very much for your response. As you noted, I do not understand
the Basemap global sinusoidal coordinate system. Does this statement
not set up a global sinusoidal cartesian coordinate system centered at
(lon = 0.0, lat = 0.0)?
m = Basemap(projection='sinu', resolution=None, lon_0=0.0, lat_0=0.0)
If so, I would expect m(0.0, 0.0) to return (0.0, 0.0) and m(0.0, 0.0,
inverse=True) to return (0.0, 0.0). Instead, I get:
>>> m(0.0,0.0)
(20015077.371199999, 10007538.6856)
>>> m(0.0,0.0,inverse=True)
(-176.20919036912957, -89.999999999808395)
Sorry if I am being obtuse. Many thanks for your help.
-Tim
On Tue, May 2010, 04 at 04:01:21PM -0600, Jeff Whitaker wrote:
> On 5/4/10 2:03 PM, Timothy W. Hilton wrote:
> >Hello matplotlib users,
> >
> >I am having trouble understanding the coordinate transformations in
> >Basemap and pyproj. I have gridded MODIS vegetation data, with upper
> >left corner and lower right corner given in projection coordinates
> >(meters). I want to contour the data with Basemap. The data are in a
> >sinusoidal projection, but the coordinates do not correspond to what
> >Basemap seems to expect.
> >
> >The code below illustrates the problem. Proj translates the upper
> >left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
> >while Basemap does not.
> >
> >#-------- code --------
> >from mpl_toolkits.basemap import Basemap
> >from mpl_toolkits.basemap import pyproj
> >
> >ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
> >lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
> >
> >sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
> >m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
> >
> >print "ULM: " + str(ulm)
> >print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
> >print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
> >#----- end code --------
> >
> >This gives:
> >ULM: [-8895604.1573329996, 3335851.5589999999]
> >Proj: (-92.327237416031437, 30.141972433747089)
> >Basemap: (-159.99950210056144, -59.99995206181125)
> >
> >I'm sure I'm missing something really simple, but I've read a lot of
> >documentation and I'm not sure what.
> >
> >Many thanks for any help.
> >
> >Best,
> >Tim
> 
> Tim: Basemap is using pyproj under the hood, but only supports a
> subset of possible proj4 projections. The basemap sinusoidal
> projection is global - you can't specify a subregion of the globe.
> I think that's where the discrepancy is coming from. I'm sure
> there's a way to plot your MODIS data on a global sinusoidal
> projection - but it will involve transforming the coordinates to the
> Basemap global sinuosidal coordinate system.
> 
> -Jeff
> 
From: Jeff W. <js...@fa...> - 2010年05月04日 22:01:29
On 5/4/10 2:03 PM, Timothy W. Hilton wrote:
> Hello matplotlib users,
>
> I am having trouble understanding the coordinate transformations in
> Basemap and pyproj. I have gridded MODIS vegetation data, with upper
> left corner and lower right corner given in projection coordinates
> (meters). I want to contour the data with Basemap. The data are in a
> sinusoidal projection, but the coordinates do not correspond to what
> Basemap seems to expect.
>
> The code below illustrates the problem. Proj translates the upper
> left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
> while Basemap does not.
>
> #-------- code --------
> from mpl_toolkits.basemap import Basemap
> from mpl_toolkits.basemap import pyproj
>
> ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
> lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
>
> sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
> m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
>
> print "ULM: " + str(ulm)
> print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
> print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
> #----- end code --------
>
> This gives:
> ULM: [-8895604.1573329996, 3335851.5589999999]
> Proj: (-92.327237416031437, 30.141972433747089)
> Basemap: (-159.99950210056144, -59.99995206181125)
>
> I'm sure I'm missing something really simple, but I've read a lot of
> documentation and I'm not sure what.
>
> Many thanks for any help.
>
> Best,
> Tim
> 
Tim: Basemap is using pyproj under the hood, but only supports a subset 
of possible proj4 projections. The basemap sinusoidal projection is 
global - you can't specify a subregion of the globe. I think that's 
where the discrepancy is coming from. I'm sure there's a way to plot 
your MODIS data on a global sinusoidal projection - but it will involve 
transforming the coordinates to the Basemap global sinuosidal coordinate 
system.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Timothy W. H. <hi...@me...> - 2010年05月04日 21:08:03
Hello matplotlib users,
I am having trouble understanding the coordinate transformations in
Basemap and pyproj. I have gridded MODIS vegetation data, with upper
left corner and lower right corner given in projection coordinates
(meters). I want to contour the data with Basemap. The data are in a
sinusoidal projection, but the coordinates do not correspond to what
Basemap seems to expect.
The code below illustrates the problem. Proj translates the upper
left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
while Basemap does not.
#-------- code --------
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.basemap import pyproj
ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
print "ULM: " + str(ulm)
print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
#----- end code --------
This gives:
ULM: [-8895604.1573329996, 3335851.5589999999]
Proj: (-92.327237416031437, 30.141972433747089)
Basemap: (-159.99950210056144, -59.99995206181125)
I'm sure I'm missing something really simple, but I've read a lot of
documentation and I'm not sure what.
Many thanks for any help.
Best,
Tim
--
Timothy W. Hilton
PhD Candidate, Department of Meteorology
The Pennsylvania State University
503 Walker Building, University Park, PA 16802
hi...@me...
From: Pau <vim...@go...> - 2010年05月04日 20:06:00
Hello,
I am trying to generate a 3d-plot
I have two functions that depend on two free parameters,
T_g = (5./512.) * Light_c**5 * a**4 / (Grav_G**3 * m**3)
T_d = 3.e4 * sqrt(a**3/ (Grav_G * m**2.))
These are given in units of time, so that I would like axis y to be
"time", running between 1.0 and 1.e7
The free parameters are "a" and "m". I would like to have the axis
x = a (semi-major axis) , distributed as a = np.arange(1.e10, 1.e15, 5.e11)
z = m (mass) , between 1.e3 and 1.e7
Light_c and Grav_G are two constants
I am trying to follow the examples in
http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html
but I cannot understand the syntax
Any help would be appreciated
thanks,
Pau
From: Timothy W. H. <hi...@me...> - 2010年05月04日 20:03:13
Hello matplotlib users,
I am having trouble understanding the coordinate transformations in
Basemap and pyproj. I have gridded MODIS vegetation data, with upper
left corner and lower right corner given in projection coordinates
(meters). I want to contour the data with Basemap. The data are in a
sinusoidal projection, but the coordinates do not correspond to what
Basemap seems to expect.
The code below illustrates the problem. Proj translates the upper
left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
while Basemap does not.
#-------- code --------
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.basemap import pyproj
ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
print "ULM: " + str(ulm)
print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
#----- end code --------
This gives:
ULM: [-8895604.1573329996, 3335851.5589999999]
Proj: (-92.327237416031437, 30.141972433747089)
Basemap: (-159.99950210056144, -59.99995206181125)
I'm sure I'm missing something really simple, but I've read a lot of
documentation and I'm not sure what.
Many thanks for any help.
Best,
Tim
--
Timothy W. Hilton
PhD Candidate, Department of Meteorology
The Pennsylvania State University
503 Walker Building, University Park, PA 16802
hi...@me...
From: Jae-Joon L. <lee...@gm...> - 2010年05月04日 19:48:08
Fixed in r8295.
Axes.annotate was not setting the _remove_method attribute.
Regards,
-JJ
On Tue, May 4, 2010 at 3:15 PM, Ryan May <rm...@gm...> wrote:
> On Tue, May 4, 2010 at 2:09 PM, KrishnaPribadi
> <Kri...@ha...> wrote:
>> I'm trying to remove or delete an annotate arrow but I'm unsuccessful. Can
>> some please help? Thanks.
>>
>> I tried the [artist].remove() but that will not work with arrows or annotate
>> objects...
>>
>> Here is some example code, please add in the code I need if you can:
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> t = np.arange(0, np.pi*2, 0.01)
>> x = np.sin(2*np.pi*t)
>> fig = plt.figure()
>> myplot = ax.plot(t, x, 'b')
>>
>> arrow = ax. annotate('my arrow', xy=(3, -0.5), xycoords='data',
>>              horizontalalignment='center',
>>              verticalalignment='center',
>>              color='red', alpha=0.5,
>>              xytext=(0, -2), textcoords='offset points',
>>              arrowprops=dict(facecolor='red', frac=0.4,
>> shrink = 0.05, alpha=0.5, width=2, headwidth=5),
>>              )
>>
>> #Code to remove arrow...
>> # arrow.remove() #this does not work...
>>
>> plt.show()
>
> You can accomplish it by:
>
> ax.texts.remove(arrow)
>
> I'd still like to know why this exception gets raised:
>
>
> NotImplementedError            Traceback (most recent call last)
>
> /home/rmay/<ipython console> in <module>()
>
> /home/rmay/.local/lib/python2.6/site-packages/matplotlib/artist.pyc in
> remove(self)
>  123       self._remove_method(self)
>  124     else:
> --> 125       raise NotImplementedError('cannot remove artist')
>  126     # TODO: the fix for the collections relim problem is to move the
>
>  127     # limits calculation into the artist itself, including
> the property
>
>
> NotImplementedError: cannot remove artist
>
> JJ, thoughts?
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Ryan M. <rm...@gm...> - 2010年05月04日 19:16:11
On Tue, May 4, 2010 at 2:09 PM, KrishnaPribadi
<Kri...@ha...> wrote:
> I'm trying to remove or delete an annotate arrow but I'm unsuccessful. Can
> some please help? Thanks.
>
> I tried the [artist].remove() but that will not work with arrows or annotate
> objects...
>
> Here is some example code, please add in the code I need if you can:
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> t = np.arange(0, np.pi*2, 0.01)
> x = np.sin(2*np.pi*t)
> fig = plt.figure()
> myplot = ax.plot(t, x, 'b')
>
> arrow = ax. annotate('my arrow', xy=(3, -0.5), xycoords='data',
>              horizontalalignment='center',
>              verticalalignment='center',
>              color='red', alpha=0.5,
>              xytext=(0, -2), textcoords='offset points',
>              arrowprops=dict(facecolor='red', frac=0.4,
> shrink = 0.05, alpha=0.5, width=2, headwidth=5),
>              )
>
> #Code to remove arrow...
> # arrow.remove() #this does not work...
>
> plt.show()
You can accomplish it by:
ax.texts.remove(arrow)
I'd still like to know why this exception gets raised:
NotImplementedError Traceback (most recent call last)
/home/rmay/<ipython console> in <module>()
/home/rmay/.local/lib/python2.6/site-packages/matplotlib/artist.pyc in
remove(self)
 123 self._remove_method(self)
 124 else:
--> 125 raise NotImplementedError('cannot remove artist')
 126 # TODO: the fix for the collections relim problem is to move the
 127 # limits calculation into the artist itself, including
the property
NotImplementedError: cannot remove artist
JJ, thoughts?
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
9 messages has been excluded from this view by a project administrator.

Showing results of 303

<< < 1 .. 9 10 11 12 13 > >> (Page 11 of 13)
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 によって変換されたページ (->オリジナル) /