|
From: Kurt F. <kur...@ho...> - 2010-01-18 23:20:05
|
Ubuntu Karmic matplotlib from repository 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 as mpl >>> mpl.__version__ '0.99.0' Running the leach_kinetics.py script and annotating the graph should display two annotations indicating the position of relevant phenomena. However, attached are two outputs, 1) as_script.pdf shows the output of the script (note the missing annotations) and 2) a panned image showing the presence of the annotation when the origin is moved into the visible area of the axes. There seems to be some strange clipping behaviour (not too sure if that is the correct term) with respect the the drawing (or not) of the arrow. It appears that if the arrow begins or ends on the axes then it is not drawn. Verification of this and tips for a matplotlib tweak to prevent it from happening would also be appreciated? Kind Regards, Kurt _________________________________________________________________ Shopping Trolley Mechanic If It Exists, You'll Find it on SEEK http://clk.atdmt.com/NMN/go/157639755/direct/01/ |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-19 01:11:56
|
This is the feature that is not properly documented.
You should call annotate with optional keyword
annotation_clip=False,
See below for the details.
http://matplotlib.sourceforge.net/api/artist_api.html?highlight=annotation#matplotlib.text.Annotation.set_annotation_clip
I'll fix the documentation.
Regards,
-JJ
On Mon, Jan 18, 2010 at 6:19 PM, Kurt Forrester
<kur...@ho...> wrote:
> Ubuntu Karmic
> matplotlib from repository
> 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 as mpl
>>>> mpl.__version__
> '0.99.0'
>
> Running the leach_kinetics.py script and annotating the graph should display
> two annotations indicating the position of relevant phenomena. However,
> attached are two outputs, 1) as_script.pdf shows the output of the script
> (note the missing annotations) and 2) a panned image showing the presence of
> the annotation when the origin is moved into the visible area of the axes.
>
> There seems to be some strange clipping behaviour (not too sure if that is
> the correct term) with respect the the drawing (or not) of the arrow. It
> appears that if the arrow begins or ends on the axes then it is not drawn.
> Verification of this and tips for a matplotlib tweak to prevent it from
> happening would also be appreciated?
>
> Kind Regards,
>
> Kurt
>
> ________________________________
> If It Exists, You'll Find it on SEEK Shopping Trolley Mechanic
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important issues
> through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: Kurt F. <kur...@ho...> - 2010-01-19 07:48:35
|
JJ thanks for the tip unfortunately there was no change. I modified the script for the hax. annotate(...) to include the annotate_clip=False, however there is no change in the behaviour of the arrows. They are not visible until the xy=(a,b) have values for "a" and "b" that are both greater than their respective origin values (0,0), otherwise they remain clipped. I tested this by replacing the "true" value with (1.0e-10,1.0e-10) resulting in the arrow becoming visible. This is a feasible work around for this instance but it may not suit all applications. Is anybody else experiencing the same issue? Is there another setting that I my tweak to overcome this? Kind Regards, Kurt > From: lee...@gm... > Date: Mon, 18 Jan 2010 19:18:31 -0500 > Subject: Re: [Matplotlib-users] Annotate Behaviour - Arrows Missing > To: kur...@ho... > CC: mat...@li... > > This is the feature that is not properly documented. > You should call annotate with optional keyword > > annotation_clip=False, > > See below for the details. > > http://matplotlib.sourceforge.net/api/artist_api.html?highlight=annotation#matplotlib.text.Annotation.set_annotation_clip > > I'll fix the documentation. > Regards, > > -JJ > > > On Mon, Jan 18, 2010 at 6:19 PM, Kurt Forrester > <kur...@ho...> wrote: > > Ubuntu Karmic > > matplotlib from repository > > 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 as mpl > >>>> mpl.__version__ > > '0.99.0' > > > > Running the leach_kinetics.py script and annotating the graph should display > > two annotations indicating the position of relevant phenomena. However, > > attached are two outputs, 1) as_script.pdf shows the output of the script > > (note the missing annotations) and 2) a panned image showing the presence of > > the annotation when the origin is moved into the visible area of the axes. > > > > There seems to be some strange clipping behaviour (not too sure if that is > > the correct term) with respect the the drawing (or not) of the arrow. It > > appears that if the arrow begins or ends on the axes then it is not drawn. > > Verification of this and tips for a matplotlib tweak to prevent it from > > happening would also be appreciated? > > > > Kind Regards, > > > > Kurt > > > > ________________________________ > > If It Exists, You'll Find it on SEEK Shopping Trolley Mechanic > > ------------------------------------------------------------------------------ > > Throughout its 18-year history, RSA Conference consistently attracts the > > world's best and brightest in the field, creating opportunities for > > Conference > > attendees to learn about information security's most important issues > > through > > interactions with peers, luminaries and emerging and established companies. > > http://p.sf.net/sfu/rsaconf-dev2dev > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > _________________________________________________________________ Video chat with Windows Live Messenger Learn how http://windowslive.ninemsn.com.au/messenger/article/870686/video-chat-with-messenger |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-19 13:52:51
|
On Tue, Jan 19, 2010 at 2:48 AM, Kurt Forrester <kur...@ho...> wrote: > I modified the script for the hax. annotate(...) to include the > annotate_clip=False, however there is no change in the behaviour of the > arrows. It should be "annotation_clip" not "annotate_clip", but it may be just a typo. Anyhow, as far as I know (as I wrote the related code), there is no other setting. And your script work fine for me when "annotation_clip" parameter is added. While I'm testing this with the current svn version of matplolib, I don't think I see any bug fix related with this after 0.99.0 release. Anyhow, It would be great if you can install the newest version of matplotlib (0.99.1 or even svn) and see if arrows are still missing. Regards, -JJ |
|
From: Kurt F. <kur...@ho...> - 2010-01-19 20:08:40
|
JJ, Indeed it is a typo in the email and not in the script. I have used "annotation_clip" with no result. Additional information that I forgot to supply was that on python 2.5/windows/matplotlib 0.98.xxx (my work machine, not accessible at the moment for the subversion number) this worked fine and there may have been a regression from this to the current 0.99.0 (in the ubuntu repository). I tried to build and install the 0.99.1 but need to profess my noobness as I an unsure as to how to get the build, which built without errors, to be installed on ubuntu as I performed the prescribed "python setup.py build" then "sudo python setup.py install" without error. However, when python is loaded/run/booted it still is looking at 0.99.0. The thing I noticed was that instead on installing in site-packages it installed in dist-package (or something like) location and I guess there is something in the python path that needs redirecting. I usually use .deb and dpkg to work out the "appropriate" place for such things (former windows user). I am not familiar with the flags to pass to the python setup script to get it to install all the build files/folders to an alternate location (presumably the correct location). If I could get some basic pointers without having to read the full details then I would be happy to try an install on one of my ubuntu machines. Additional note is that I have installed the windows binary (0.99.1) on a python2.6 install and the same clipping behaviour occurs (no arrows to be seen) the same script run on the my work machine (2.5 and 0.98.xxx) works fine (arrows to be seen in all their glory). Tomorrow I will send through the outputs from the various machines I have to see if I can find when the world changed for these arrows. Finally, can you reproduce the phenomenon that I see on your install of matplotlib? Thank you very much for the guidance, Kurt > From: lee...@gm... > Date: Tue, 19 Jan 2010 08:52:24 -0500 > Subject: Re: [Matplotlib-users] Annotate Behaviour - Arrows Missing > To: kur...@ho... > CC: mat...@li... > > On Tue, Jan 19, 2010 at 2:48 AM, Kurt Forrester > <kur...@ho...> wrote: > > I modified the script for the hax. annotate(...) to include the > > annotate_clip=False, however there is no change in the behaviour of the > > arrows. > > It should be "annotation_clip" not "annotate_clip", but it may be just a typo. > > Anyhow, as far as I know (as I wrote the related code), there is no > other setting. And your script work fine for me when "annotation_clip" > parameter is added. While I'm testing this with the current svn > version of matplolib, I don't think I see any bug fix related with > this after 0.99.0 release. > > Anyhow, It would be great if you can install the newest version of > matplotlib (0.99.1 or even svn) and see if arrows are still missing. > > Regards, > > -JJ _________________________________________________________________ Time for a new car? Sell your old one fast! http://clk.atdmt.com/NMN/go/157637060/direct/01/ |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 17:19:05
|
On Tue, Jan 19, 2010 at 3:08 PM, Kurt Forrester
<kur...@ho...> wrote:
> Additional information that I forgot to supply was that on python
> 2.5/windows/matplotlib 0.98.xxx (my work machine, not accessible at the
> moment for the subversion number) this worked fine and there may have been a
> regression from this to the current 0.99.0 (in the ubuntu repository).
>
The "annotation_clip" feature is introduced in 0.99.0, and annotations
are not clipped before that version.
Again, your script works fine if I add annotation_clip parameter. So,
I'm not sure what's going on. Can anyone else reproduce this problem?
Just in case, with the following code, do you see label "Test"? It
should be seen near where the xlabel is seen.
fig = figure()
ax=subplot(111)
ax.annotate("Test", (-0.1, 0.5), annotation_clip=False)
Regards,
-JJ
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 18:51:12
Attachments:
annotate_debug.py
|
On Wed, Jan 20, 2010 at 1:13 PM, Kurt Forrester <kur...@ho...> wrote: > I am not too sure what the design behaviour is but it is certainly not doing > what I expected. I do appreciate your effort in resolving this. Please do > let me know if there are any further tests I can perform to demonstrate the > issue or test for fixes. > "annotate" is meant to annotate a data point. It does not have much meaning to draw the annotating text when the annotated data point is not visible (i.e. when the data point is outside the axes). And this is the default behavior of the current matplotlib. As I cannot reproduce the problem, it is hard to track down what is wrong. I'm attaching a little debugging script. Please try to run this code and report the output. For example, I get annotation_clip = False _check_xy returning True Drawing Text Your output may be different. Regards, -JJ |
|
From: Kurt F. <kur...@ho...> - 2010-01-20 20:07:23
|
> From: lee...@gm... > Date: Wed, 20 Jan 2010 13:50:45 -0500 > Subject: Re: [Matplotlib-users] Annotate Behaviour - Arrows Missing > To: kur...@ho... > CC: mat...@li... > > On Wed, Jan 20, 2010 at 1:13 PM, Kurt Forrester > <kur...@ho...> wrote: > > I am not too sure what the design behaviour is but it is certainly not doing > > what I expected. I do appreciate your effort in resolving this. Please do > > let me know if there are any further tests I can perform to demonstrate the > > issue or test for fixes. > > > > "annotate" is meant to annotate a data point. It does not have much > meaning to draw the annotating text when the annotated data point is > not visible (i.e. when the data point is outside the axes). And this > is the default behavior of the current matplotlib. > > As I cannot reproduce the problem, it is hard to track down what is wrong. > I'm attaching a little debugging script. Please try to run this code > and report the output. For example, I get > > annotation_clip = False > _check_xy returning True > Drawing Text > > Your output may be different. > > Regards, > > -JJ thanks for the details on the design. the output from the script is: annotation_clip = None checking is point is inside the axes : [ 30.875 233. ] contains_point = 0 _check_xy returning False exit without drawing due to annotation_clip _________________________________________________________________ Search for properties that match your lifestyle! Start searching NOW! http://clk.atdmt.com/NMN/go/157631292/direct/01/ |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 22:35:47
|
On Wed, Jan 20, 2010 at 3:07 PM, Kurt Forrester
<kur...@ho...> wrote:
> the output from the script is:
>
> annotation_clip = None
> checking is point is inside the axes : [ 30.875 233. ]
> contains_point = 0
> _check_xy returning False
> exit without drawing due to annotation_clip
>
>
Weird.
How about this one?
fig = figure()
ax=subplot(111)
txt = ax.annotate("Test", (-0.1, 0.5), annotation_clip=False)
print txt.get_annotation_clip()
If it still print out None, see if the next code make any difference.
fig = figure()
ax=subplot(111)
txt = ax.annotate("Test", (-0.1, 0.5))
txt.set_annotation_clip(False)
print txt.get_annotation_clip()
-JJ
|
|
From: Kurt F. <kur...@ho...> - 2010-01-21 14:37:34
|
> From: lee...@gm...
> Date: Wed, 20 Jan 2010 17:35:21 -0500
> Subject: Re: [Matplotlib-users] Annotate Behaviour - Arrows Missing
> To: kur...@ho...
> CC: mat...@li...
>
> On Wed, Jan 20, 2010 at 3:07 PM, Kurt Forrester
> <kur...@ho...> wrote:
> > the output from the script is:
> >
> > annotation_clip = None
> > checking is point is inside the axes : [ 30.875 233. ]
> > contains_point = 0
> > _check_xy returning False
> > exit without drawing due to annotation_clip
> >
> >
>
> Weird.
> How about this one?
>
> fig = figure()
> ax=subplot(111)
> txt = ax.annotate("Test", (-0.1, 0.5), annotation_clip=False)
> print txt.get_annotation_clip()
>
> If it still print out None, see if the next code make any difference.
>
> fig = figure()
> ax=subplot(111)
> txt = ax.annotate("Test", (-0.1, 0.5))
> txt.set_annotation_clip(False)
> print txt.get_annotation_clip()
>
>
> -JJ
The first one reported None.
The second one reported False.
Kurt
_________________________________________________________________
Time for a new car? Sell your old one fast!
http://clk.atdmt.com/NMN/go/157637060/direct/01/ |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-21 15:46:35
|
On Thu, Jan 21, 2010 at 9:37 AM, Kurt Forrester <kur...@ho...> wrote: > The first one reported None. > The second one reported False. And the text is still not drawn with the second example? -JJ |
|
From: Kurt F. <kur...@ho...> - 2010-01-21 17:53:33
|
> From: lee...@gm... > Date: Thu, 21 Jan 2010 10:46:00 -0500 > Subject: Re: [Matplotlib-users] Annotate Behaviour - Arrows Missing > To: kur...@ho... > CC: mat...@li... > > On Thu, Jan 21, 2010 at 9:37 AM, Kurt Forrester > <kur...@ho...> wrote: > > The first one reported None. > > The second one reported False. > > And the text is still not drawn with the second example? > > -JJ Sorry the text IS drawn in the second example. So the setting of the attribute after it is drawn (before it is shown) seems to do the trick. Kurt _________________________________________________________________ Search for properties that match your lifestyle! Start searching NOW! http://clk.atdmt.com/NMN/go/157631292/direct/01/ |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-21 18:22:10
|
On Thu, Jan 21, 2010 at 12:53 PM, Kurt Forrester <kur...@ho...> wrote: > Sorry the text IS drawn in the second example. So the setting of the > attribute after it is drawn (before it is shown) seems to do the trick. > > Kurt It seems that somehow the annotation_clip parameter is ignored when it is given during the object creation. While I'm not 100% sure, this seems to be fixed in the current svn where it does work. And I presume your original script will also work if you call set_annotation_clip explicitly. Let me know if there is any other problem. Regards, -JJ |
|
From: Kurt F. <kur...@ho...> - 2010-01-21 21:13:44
|
> From: lee...@gm... > Date: Thu, 21 Jan 2010 13:21:41 -0500 > Subject: Re: [Matplotlib-users] Annotate Behaviour - Arrows Missing > To: kur...@ho... > CC: mat...@li... > > On Thu, Jan 21, 2010 at 12:53 PM, Kurt Forrester > <kur...@ho...> wrote: > > Sorry the text IS drawn in the second example. So the setting of the > > attribute after it is drawn (before it is shown) seems to do the trick. > > > > Kurt > > It seems that somehow the annotation_clip parameter is ignored when it > is given during the object creation. While I'm not 100% sure, this > seems to be fixed in the current svn where it does work. > > And I presume your original script will also work if you call > set_annotation_clip explicitly. > Let me know if there is any other problem. > > Regards, > > -JJ JJ, I can confirm that by calling .set_annotation_clip(False) after the creation of the object makes all the annotations appear as expected. I will amend my code until I get the latest version installed. Just to add one more query to the thread, do you consider a point on a vertex of the axes to be a candidate for annotation without clipping? That is to say if there is a point (0,0) I wish to annotate, and the origin of the axes contains that point (0,0), would you (by design) want to be able to annotate that point? My initial uncertainty as to why I need to have the clipping turned to False in the first instance is because I thought that if a point may fall on a any of the vertices they still should be considered in the visible field. This is just a thought. Thank you for your effort on this. Kind Regards., Kurt _________________________________________________________________ Time for a new car? Sell your old one fast! http://clk.atdmt.com/NMN/go/157637060/direct/01/ |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-21 21:43:25
|
On Thu, Jan 21, 2010 at 4:13 PM, Kurt Forrester <kur...@ho...> wrote: > Just to add one more query to the thread, do you consider a point on a > vertex of the axes to be a candidate for annotation without clipping? That > is to say if there is a point (0,0) I wish to annotate, and the origin of > the axes contains that point (0,0), would you (by design) want to be able to > annotate that point? My initial uncertainty as to why I need to have the > clipping turned to False in the first instance is because I thought that if > a point may fall on a any of the vertices they still should be considered > in the visible field. > I would agree with you. However, the current behavior inherits from how "inside test" is done for paths in general (point_in_path_impl in src/_path.cpp). So there is not much thing I can help. We may check if the point is "on" the path addiitionally, but I'm not sure if there is a relevant routine (while there is point_on_path, but I'm not sure if this is it). I'll try to take a further look later. Regards, -JJ |