Re: [Matplotlib-users] Using dates in a simple plot with wxPython doesn't work

2015-07-28 Thread Brendan Barnwell
On 2015-07-28 10:31,  (by way of c.bu...@posteo.jp) wrote:
> I try to use a dates on the x-aches. With pure Python3 code it works
> fine. BUt when I try to use this inside wxPython application on a
> FigureCanvas it doesn't work. And I don't understand the difference
> here.
>
> This is the error
> [err]
>  plot.plot([datetime.date(2015, 1, 7),
> TypeError: descriptor 'date' requires a 'datetime.datetime' object but
> received a 'int'
> [/err]
>
> This is the fine working pure Python3 code.

> import datetime

> This is the piece of wxPython code that cause the error

> from datetime import datetime

There is the problem.  The error has nothing to do with matplotlib.  In 
one case you did "import datetime" and imported the datetime library. 
In the other you did "from datetime import datetime", thus importing the 
datetime type from that library.  If your first version is working, 
change the second version to use the same import.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no 
path, and leave a trail."
--author unknown

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to visualize a, b results of x, y variables

2015-07-09 Thread Brendan Barnwell
On 2015-07-09 07:40, Jonno wrote:
> I was thinking of doing that or having 2 surface plots but I think it
> would be visually quite confusing.
> I was trying to think of an example since I'm sure someone has come up
> with a nice way to display this kind of data.
> Imagine if the data was average temperature (a) and average rainfall (b)
> for a region in the world (lat/long = x,y). The goal is to display the
> data such that it's obvious where the locations are that have closest to
> the ideal temp/rain combination.
> How would you go about that?

It's not an easy thing to visualize in general.  You might want to look 
at approaches to visualizing complex functions (i.e., functions whose 
input and output are both complex variables).  These essentially map 
pairs (a, b) to pairs (x, y) as in your situation, and mathematicians 
have come up with various ways to visualize them.  Some are described at 
https://www.pacifict.com/ComplexFunctions.html and the wikipedia article 
at https://en.wikipedia.org/wiki/Complex_analysis has some links in the 
references to web pages for graphing such functions.

If the data are measured at (or can be reasonably reduced to) discrete 
points (as temp/rainfall are likely to be), another possibility is a 
scatterplot using, say, the color and size of the markers as indicators 
of the two variables (e.g., red/blue for hot/cold temp, larger/smaller 
circles for higher/lower rainfall).

In some cases, like your example with temperature and rainfall, you may 
instead be able to combine the two output dimensions into a single one 
that somehow captures the overall "distance" from the ideal point.  That 
is, for a given point, if your goal is to show how close it is to the 
ideal *combination* of temp and rain, you may not need to display how 
close it is on each dimension separately, but just how close it is to 
the ideal overall.  Exactly how to compute this would vary based on the 
data (e.g., standardizing the values and taking the euclidean distance 
from the ideal).

Your temp/rainfall example caught my eye because a few years ago I did 
a blog post on a similar topic, considering temperature and humidity 
(http://iq.brenbarn.net/2011/11/18/good-days-mate/).  There I decided to 
graph just a single variable, namely the number of days on which either 
temperature *or* humidity is outside a "comfortable" range.  Obviously 
this approach may not make sense for every situation.  But what I mean 
is that, in some cases, you can use domain-specific knowledge about what 
the dimensions mean to combine them into one dimension that approximates 
what it is you're trying to illustrate with the graph.


-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no 
path, and leave a trail."
--author unknown

--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animation.FuncAnimation example --- how does it work?

2015-04-23 Thread Brendan Barnwell
On 2015-04-23 03:22, Virgil Stokes wrote:
>
> 1. There are 3 positional arguments given for animation.FuncAnimation;
> but, in the
> API documentation for this class
> (http://matplotlib.org/api/animation_api.html), only
> two positional arguments are shown.

One thing I think may be misleading you is that you seem to be 
misunderstanding how positional and keyword arguments work in Python. 
Specifying a default value for an argument in a function definition 
doesn't mean that you can *only* pass it by keyword when you call it. 
Any named argument can always be passed positionally or by keyword (in 
Python 2).  For instance, if I define a function like this:

def foo(a, b=2):
 print a+b

I can still call it like this:

foo(8, 10)

I can even call it like this (passing both arguments as keywords "out of 
order")

foo(b=10, a=8)

Writing "b=2" in the function definition doesn't so much "make b a 
keyword argument" as just "specify a default value for b".  So in the 
FuncAnimation documentation you mentioned, "frames" is not required to 
be a keyword argument, and can still be passed positionally.  (In Python 
3 there are keyword-only arguments, and even in Python 2 the variadic 
**kwargs syntax collects only keyword arguments, but those aren't 
involved as far as the "frame" argument here is concerned.)

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no 
path, and leave a trail."
--author unknown

--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Install Problem

2015-02-13 Thread Brendan Barnwell
On 2015-02-13 01:47, ralph hosmer wrote:
> download: matplotlib-1.4.2-cp32-none-win_amd64.whl  [from Sourceforge]
> my system: hp Pavilion 500-314 Desktop
>  AMD A8-7600 Accelerated Processor
>  Windows 8.1
> Python 3.4.2 (on Win32)
> PyCharm 4 Community Edition
>
> In the Python Command Line window, I've tried most of the "install
> matplotlib" instructions, but continue to get "Syntax Error".
> Double-clicking on the downloaded matplotlib (.whl) file asks what I
> want to use to open the file.
> I'm new to Python, and am a loss as to how to install "matplotlib"!
> Please Help !!

Well, one thing is that an installer with "cp32" in the filename is for 
Python 3.2.  For Python 3.4 you need the one that says "cp34".

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no 
path, and leave a trail."
--author unknown

--
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Key events using nbagg backend

2014-12-04 Thread Brendan Barnwell
On 2014-12-04 15:40, Joe Kington wrote:
> Nbagg is non-interactive, similar to Agg. No events other than draw events
> are supported, as far as I know.

If that's the case, the release notes should probably make that clear. 
  Right now at 
http://matplotlib.org/users/whats_new.html#the-nbagg-backend it says: 
"Phil Elson added a new backend, named “nbagg”, which enables 
interactive figures in a live IPython notebook session."  The word 
"interactive" certainly could lead people to believe that the backend 
is, in fact, interactive.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no 
path, and leave a trail."
--author unknown

--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram appearance

2014-12-03 Thread Brendan Barnwell
On 2014-12-03 12:39, Amit Saha wrote:
> Hi,
>
> Please find attached a simple histogram created using the hist()
> function. Any idea why the last two bars are squeezed into each other?
> Is there a simple way to fix this while plotting?

It looks like the bins are set up so that there are empty bins between 
each of the other bars.  How are you setting the bins?  You could try 
adjusting the bin boundaries.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no 
path, and leave a trail."
--author unknown

--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with event handling in matplotlib in tkinter

2014-11-07 Thread Brendan Barnwell
On 2014-11-07 09:37, Benjamin Root wrote:
> Figured it out! The instance of Test() isn't being retained anywhere, so
> when it goes out of scope, the garbage collector eventually gets it. The
> fact that it works in py3k is likely a coincidence as the garbage
> collector would eventually have cleaned it up at some point. I don't
> know the scoping/garbage collection rules for lambdas, so I am guessing
> that they persist as they are part of the code as opposed to a
> de-reference-able (is that even a word?). Just save the instance of Test
> as a member variable of App, and you should be good to go!

This note in cbook.py (which handles the callback registry) explains 
it. . . sort of:

In practice, one should always disconnect all callbacks when they
are no longer needed to avoid dangling references (and thus memory
leaks).  However, real code in matplotlib rarely does so, and due
to its design, it is rather difficult to place this kind of code.
To get around this, and prevent this class of memory leaks, we
instead store weak references to bound methods only, so when the
destination object needs to die, the CallbackRegistry won't keep
it alive.  The Python stdlib weakref module can not create weak
references to bound methods directly, so we need to create a proxy
object to handle weak references to bound methods (or regular free
functions).  This technique was shared by Peter Parente on his
`"Mindtrove" blog
<http://mindtrove.info/articles/python-weak-references/>`_.

Definitely a hidden trap!

Also, speaking of the dangers of classes not inheriting from object, I 
noticed that CallbackRegistry in cbook.py is also an old-style class 
(doesn't inherit from object).  I then did a search and found numerous 
old-style classes throughout MPL.  Is there any reason for this?

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no 
path, and leave a trail."
--author unknown

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pick_event after zooming/panning stops working.

2014-08-21 Thread Brendan Barnwell
On 2014-08-21 11:55, Michael Kaufman wrote:> My user-story is that I 
have say several axvlines very close together in
 > bunches in the standard xlim(). Take for example spectral lines (or 
fits
 > to spectral lines). I want to pick a line and have the program tell me
 > the x-location of that line. Since they're close together I need to 
zoom
 > in to discriminate them. I don't want to have to zoom in, then move the
 > mouse to unselect the zoom tool before moving the mouse back to do the
 > pick or multiple picks.

It sounds like a possible solution would be keyboard shortcuts for 
the toolbar tools, so that zoom could be activated/deactivated without 
moving the mouse.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basic matshow question

2014-07-30 Thread Brendan Barnwell
On 2014-07-30 14:51, Eric Firing wrote:
> On 2014/07/30, 7:26 AM, Benjamin Root wrote:
>> There is no --pylab for that.
>
> I don't know what development version you are using, but for 2.1.0, it
> is still there--and it does what needs to be done.

He was talking about the normal Python interpreter, not IPython.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] timer objects in macosx backend

2013-07-18 Thread Brendan Barnwell
On 2013-07-18 06:56, Justin Lazear wrote:> Hi Michiel,
 >
 > On my system, deleting the timer has no effect and the timer continues
 > to send events. The __del__ method seems to call the same unimplemented
 > _timer_stop method. Regardless, something else has a reference to the
 > timer (MPL event loop maybe?) and __del__ is not being called once the
 > timer has been started. It's not clear to me what should be 
stopping the
 > timer in that case.
 >
 > Does del t stop the timer on your system? If so, could we hunt down 
what
 > is happening after you delete the name t that is causing the timer 
to stop?
 >
 > I would personally prefer an explicit .stop() method, since I would
 > prefer not to rely on the garbage collector's behavior being consistent
 > (hard to make sure nothing else is holding a reference to timer) when
 > there is a very well-defined function that does what I want.

Relying on "del t" can't be the right solution, since like you note, 
it only deletes the name, not the object.  If you create multiple 
references to a timer and only del some of them, e.g.:

t = fig.canvas.new_timer()
x = t
del t

Then the object's __del__ will definitely not be called yet.  It makes 
sense to have a way to stop the timer directly, regardless of how many 
names are pointing to it.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Individual custom markers and colorbar

2013-04-26 Thread Brendan Barnwell
On 2013-04-26 08:31, Sterling Smith wrote:
 > Notwithstanding these probably work (I haven't tried), my gut
reaction would have been to color the edges the same as the face,
although I don't know if you can give set_edgecolor the same
cmap(colors_norm) argument.

I think you can set the edgecolor equal to the string 'face' to make 
it use the facecolor.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] set limits not obeyed for stacked plots when set_aspect('equal') used

2013-03-20 Thread Brendan Barnwell


On 2013-03-20 14:25, Eric Firing wrote:
 > > On 2013/03/20 8:57 AM, Jonathan Slavin wrote:
 >> >> Hi all,
 >> >>
 >> >> I've run across a minor but annoying bug.  It can be 
demonstrated pretty
 >> >> simply:
 >> >>
 >> >> fig, ax = plt.subplots(2,1,sharex=True,figsize=(7.,7.))
 >> >> fig.subplots_adjust(hspace=0.0)
 >> >> x = 4.25*(np.arange(6.) - 2.5)/10.
 >> >> y =  0.6*x/max(x)
 >> >> ax[0].plot(x,y)
 >> >> ax[0].set_xlim(-1.2,1.2)
 >> >> ax[0].set_aspect('equal')
 >> >> ax[1].plot(x,y)
 >> >> ax[0].set_ylim(-0.6,0.6)
 >> >> ax[1].set_ylim(-0.6,0.6)
 >> >> ax[1].set_aspect('equal')
 >> >> plt.show()
 >> >>
 >> >> The problem is that the y limits on the two plots are slightly 
different
 >> >> from those set:
 > >
 > > I think the problem is that you are trying to specify too many 
things:
 > > you are specifying the box dimensions when you make the axes, 
then you
 > > are specifying xlim, and then you are specifying ylim, but then 
you are
 > > asking for a 1:1 aspect ratio.  Something has to give!  The 
aspect ratio
 > > handling is designed to provide the specified aspect ratio under 
a wide
 > > range of circumstances, including zooming and panning, and to do 
that,
 > > it has to be able to change something.  You can choose to let the box
 > > dimensions be changeable, or the data limits.

If I understand right, though, in this case what should give is the
spacing around the axes but inside the figure (as suggested in the
original post).  You should be able to fix the aspect ratio of the
*axes* and also the dimensions of the *figure*, and let the slack be
taken up by blank space around the axes.  It would still be possible
for the dimensions of the axes box to change, just not their aspect
ratio (i.e., zooming in on an oblong region would just result in a lot
of blank space).

-- Brendan Barnwell "Do not follow where the path may lead. Go, 
instead, where there is no path, and leave a trail." --author unknown


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] set limits not obeyed for stacked plots when set_aspect('equal') used

2013-03-20 Thread Brendan Barnwell
On 2013-03-20 14:25, Eric Firing wrote:
> On 2013/03/20 8:57 AM, Jonathan Slavin wrote:
>> Hi all,
>>
>> I've run across a minor but annoying bug.  It can be demonstrated pretty
>> simply:
>>
>> fig, ax = plt.subplots(2,1,sharex=True,figsize=(7.,7.))
>> fig.subplots_adjust(hspace=0.0)
>> x = 4.25*(np.arange(6.) - 2.5)/10.
>> y =  0.6*x/max(x)
>> ax[0].plot(x,y)
>> ax[0].set_xlim(-1.2,1.2)
>> ax[0].set_aspect('equal')
>> ax[1].plot(x,y)
>> ax[0].set_ylim(-0.6,0.6)
>> ax[1].set_ylim(-0.6,0.6)
>> ax[1].set_aspect('equal')
>> plt.show()
>>
>> The problem is that the y limits on the two plots are slightly different
>> from those set:
>
> I think the problem is that you are trying to specify too many things:
> you are specifying the box dimensions when you make the axes, then you
> are specifying xlim, and then you are specifying ylim, but then you are
> asking for a 1:1 aspect ratio.  Something has to give!  The aspect ratio
> handling is designed to provide the specified aspect ratio under a wide
> range of circumstances, including zooming and panning, and to do that,
> it has to be able to change something.  You can choose to let the box
> dimensions be changeable, or the data limits.

If I understand right, though, in this case what should give is the 
spacing around the axes but inside the figure (as suggested in the 
original post).  You should be able to fix the aspect ratio of the 
*axes* and also the dimensions of the *figure*, and let the slack be 
taken up by blank space around the axes.  It would still be possible 
for the dimensions of the axes box to change, just not their aspect 
ratio (i.e., zooming in on an oblong region would just result in a lot 
of blank space).

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Evolution of the interface

2013-03-15 Thread Brendan Barnwell
On 2013-03-15 08:19, Paul Hobson wrote:> On Fri, Mar 15, 2013 at 8:01 
AM, Christophe BAL  wrote:
 >
 >> Hello,
 >> I really appreciate the work done by matplotlib but I really think 
that
 >> the interface must evolve. Here is a small example.
 >>
 >> *object.set_something(...)*
 >> *object.get_something()*
 >>
 >> It could be easier to use a jQuery like style as in the following 
lines.
 >>
 >> *object(...)*
 >> *object()*

 > Interesting thoughts, Christophe. There is currently a MEP to do 
something
 > similar:
 > https://github.com/matplotlib/matplotlib/wiki/MEP13

I think the current situation is better than this jQuery style, and 
the MEP is better than the current situation.  Using lots of verbose 
getters and setters is unpythonic, but calling objects directly in 
that catch-all way is even more unpythonic.  There are lots of things 
you might want to do to an MPL object, and we shouldn't elevate 
attribute get/set as the "main one" that should be accessed by the 
call syntax.

That MEP would be great, though!

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting with WxAgg backend hangs

2013-03-11 Thread Brendan Barnwell
I'm 64-bit Windows 7 with matplotlib 1.2.0 and WxPython 2.8.12.1.  I 
was fiddling around with some of the different backends to see what 
they look like and I found that the WxAgg backend doesn't work:

Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit 
(AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import matplotlib as mpl
 >>> mpl.use('WxAgg')
 >>> from matplotlib import pyplot
 >>> pyplot.ion()
 >>> pyplot.plot([1, 2, 3])
[]
 >>>

When I do the plot, the figure windows appears, but it's blank 
(without even a proper blank background, just a white area) and 
immediately shows "Not responding".  I have to kill the window, and 
doing so crashes the Python session.  However, it works without the 
"ion()" call: I can then call show() and see the plot fine.

I have wxPython working fine in other apps.  In fact, what's 
especially odd is that I actually have an app that directly uses 
FigureCanvasWxAgg to embed matplotlib graphs in a GUI, and this seems 
to work fine.  So it seems the problem is somehow in matplotlib's own 
management of the interactive figure window.

There was a previous question about a similar WxAgg issue on the list 
( 
http://matplotlib.1069221.n5.nabble.com/trouble-with-show-not-drawing-in-interactive-mode-w-WxAgg-td39110.html
 
), but there was no real answer: the poster just decided not to use 
WxAgg.  But aren't we really supposed to be able to use WxAgg 
interactively?

Thanks,
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Pick PathCollection component by interior

2013-01-10 Thread Brendan Barnwell
I have a PathCollection with a lot of closed paths.  I'm trying to 
implement a "data cursor" as described here: 
http://stackoverflow.com/questions/4652439/is-there-a-matplotlib-equivalent-of-matlabs-datacursormode
 
.  I've done this successfuly in the past when the objects I wanted to 
pick were points.  However, with this PathCollection, I want to be 
able to click inside the region enclosed by a path, and select the 
path that encloses that region.  Using the basic sort of code as shown 
in that post, it seems to only select the path when you click on the 
path itself --- that is, the boundary of the region.

How can I get a pick event for a PathCollection that tells me the 
path whose interior I clicked in?  To make things even more 
complicated, some of the paths are not simply-connected and contain 
other paths inside their "holes", but even handling it without that 
wrinkle would be a start.

Thanks,
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Novice question: Am I using pyplot.rgrids correctly?

2012-12-17 Thread Brendan Barnwell
On 2012-12-17 20:05, Andre' Walker-Loud wrote:
>>> I reiterate that in polar coordinates, a negative value of "r"
>>> does not make sense.  It is confusing at best.
>>
>> This isn't really true.  Many standard introductions to polar
>> coordinates consider negative r as valid.  It's simply treated as
>> a radius in the opposite direction
>
> In Euclidean space, can you have a negative distance?  Would you
> ever describe a circle as having negative radius (in Euclidean
> space)?  If you take "r" to be the radius, then I suggest you
> confuse a precise definition of radius with allowing a useful,
> non-unique interpretation of negative values of "r".

I don't take r to be "the radius", I take it to be a number in an 
ordered pair with a particular mapping into R^2.  It is an extension 
of the notion of radius, but there's no reason it has to conform with 
the restrictions on geometrically possible radii.

However, those issues are beside the point.  The point is that, 
regardless of what a radius is, in the context of polar coordinates, a 
negative *r-coordinate* is a perfectly mathematically respectable 
notion with a standard interpretation.  Moreover, it is actually 
useful when you want to graph some things, and is supported by other 
plotting software (see, e.g., 
http://www.wolframalpha.com/input/?i=polar+plot+r%3Dtheta%2C-pi%3Cr%3C0). 
  Matplotlib should plot r-coordinates according to this standard 
interpretation,

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Novice question: Am I using pyplot.rgrids correctly?

2012-12-17 Thread Brendan Barnwell
On 2012-12-17 14:36, Andre' Walker-Loud wrote:
> On Dec 17, 2012, at 1:12 PM, Pierre Haessig wrote:
>
>> Le 17/12/2012 21:59, Pierre Haessig a écrit :
>>> Maybe this the code behind the masking of half your curve, but I don't
>>> know more.
>> Looking closer at the plot, the curve is actually not masked !
>>
>> Actually the "rmin functionality' is activated with rmin=-2*pi so that
>> the whole r-axis is offset by +2pi. The plot is therefore pretty
>> consistent only it is not what you want, I guess.
>> I don't know how to disable this radius offset functionality.
>
> Hi Pierre, Bob and all,
>
> I reiterate that in polar coordinates, a negative value of "r" does not make 
> sense.  It is confusing at best.

This isn't really true.  Many standard introductions to polar 
coordinates consider negative r as valid.  It's simply treated as a 
radius in the opposite direction (i.e., the point is reflected about 
the origin).  A few examples found by googling: 
http://tutorial.math.lamar.edu/Classes/CalcII/PolarCoordinates.aspx 
and 
http://sites.csn.edu/istewart/mathweb/math127/intro_polar/intro_polar.htm 
and an MIT Opencourseware document at 
http://ocw.mit.edu/resources/res-18-001-calculus-online-textbook-spring-2005/study-guide/MITRES_18_001_guide9.pdf.
 


    Matplotlib shouldn't raise an error on negative r, it should just 
interpret negative r values correctly.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Why does contourf with the extend argument tweak the data limits?

2012-07-09 Thread Brendan Barnwell
On 2012-07-09 06:13, Benjamin Root wrote:
> On Sun, Jul 8, 2012 at 9:04 PM, Brendan Barnwellwrote:
>>  cs = pyplot.contourf(x,y,z,levels=np.arange(50, 220, 20),
>>  cmap=pyplot.cm.jet, extend='both')
>>  cs.cmap.set_under('k')
>>  cs.set_clim(50, 210)
>>  cb = pyplot.colorbar(cs)
>>
>>  But why do I have to do this?  The whole reason I passed in my
>>  specified levels was because I wanted THOSE to be the data limits.
>>  Why is matplotlib expanding the data limits, and thus preventing me
>>  from specifying the "out of range" color using the normal set_under
>>  and set_over methods?
>>
>>
> You are right, that behavior is very inconsistent with the documentation.
> Looking over the QuadContourSet._process_levels() method, I doubt the
> problem lies there.  While testing, I noticed that whatever color I set for
> set_under() was always being ignored in the colorbar.  I suspect the
> problem lies there.

You mean in the colorbar and/or set_under?  I don't think so, because 
the problem occurs whether or not you use a colorbar, and, at least 
for me, set_under works as long as the data limits are set correctly. 
  If in my code above, I change set_under("k") to set_under("yellow") 
or whatever else I like, that color is correctly used both in the 
contourf plot and on the colorbar (on the lower arrow).  The code that 
I pointed to in _process_levels is setting vmin and vmax.  It's 
possible this isn't the root of the problem, but the code certainly 
looks strange and unmotivated, and it is what's causing incorrect clim 
to be set.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Why does contourf with the extend argument tweak the data limits?

2012-07-08 Thread Brendan Barnwell
I just spent some time debugging an odd problem.  Take this code:

x,y = np.arange(-10,10), np.arange(-10,10)
x,y = np.meshgrid(x,y)
z = x**2+y**2
cs = pyplot.contourf(x,y,z,levels=np.arange(50, 220, 20), 
cmap=pyplot.cm.jet, extend='both')
cs.cmap.set_under('k')
cb = pyplot.colorbar(cs)

I was expecting the set_under call to mean that contours outside the 
passed level range would be painted in that color.  This seems to be 
what the documentation says will happen:

"Unless this [extend argument] is ‘neither’, contour levels are 
automatically added to one or both ends of the range so that all data 
are included. These added ranges are then mapped to the special 
colormap values which default to the ends of the colormap range, but 
can be set via matplotlib.colors.Colormap.set_under() and 
matplotlib.colors.Colormap.set_over() methods." 

. . .but it doesn't work.  Instead, the levels outside my specified 
range show up colored the same as the lowest selected level (i.e., 50).

I poked around in the code and found that the culprit is this section 
in matplotlib.contour.ContourSet._process_levels():

 if self.extend in ('both', 'min'):
 self.vmin = 2 * self.levels[0] - self.levels[1]
 if self.extend in ('both', 'max'):
 self.vmax = 2 * self.levels[-1] - self.levels[-2]

Here, if the "extend" argument is given, the code sets the data limits 
to some odd extension of the actual data limits.  I can fix it and get 
the correct output by resetting the data limits after plotting my 
contours:

cs = pyplot.contourf(x,y,z,levels=np.arange(50, 220, 20), 
cmap=pyplot.cm.jet, extend='both')
cs.cmap.set_under('k')
cs.set_clim(50, 210)
cb = pyplot.colorbar(cs)

But why do I have to do this?  The whole reason I passed in my 
specified levels was because I wanted THOSE to be the data limits. 
Why is matplotlib expanding the data limits, and thus preventing me 
from specifying the "out of range" color using the normal set_under 
and set_over methods?

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] What is your matplotlib workflow?

2012-06-18 Thread Brendan Barnwell
On 2012-06-09 15:18, pybokeh wrote:
 > Maybe workflow may not be the appropriate term.  Essentially, when 
I want
 > to plot something using matplotlib, I find myself having to look up 
the api
 > docs or examples online because quite frankly, matplotlib's syntax 
is very
 > hard to remember.  I use ipython and use tab browsing, help(), 
dir(), etc,
 > and that seem to help to some extent.  I absolutely love 
matplotlib, but
 > when I want to put a chart up quickly, matplotlib is just a "hassle"
 > depending on what chart you want to create.  I do expect this since
 > plotting with matplotlib, you are essentially creating a chart
 > "programmatically", instead of GUI interface environment.  But still, I
 > feel like an improvement could still be made in making charts 
simpler with
 > matplotlib.

Just wanted to mention that I've managed to get a good workflow going 
using DreamPie.  I haven't seen much talk about DreamPie on here, but 
it's really useful for working with matplotlib.  Although I haven't 
used ipython, I get the impression DreamPie is like a GUI version of 
that.  It provides a two-window interface sort of like a chat or MUD 
client, with a separate editing window where you can enter code, and 
an output window where your code and results are displayed.

Most importantly for present purposes, it's matplotlib-aware so you 
can use interactive plotting commands and have it "just work" (i.e., 
not hang the program as with IDLE).  It also provides name-completion 
and docstring tooltips, making it easy to scan the docs for a 
particular function to refresh my memory about its arguments. 
DreamPie makes it pretty doable to make iterative tweaks to the same 
plotting code until I get it into a form that I want, at which point I 
can copy and paste it into a file for storage.

I do think there are areas where matplotlib starts to get in its own 
way, in that its powerful features obscure the path toward simple 
goals.  It seems like wrapper libs that provide a simpler interface 
(like I guess this Canvas thing you mentioned) could be useful for 
getting around that.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Certain annotation parameters cause strange error

2011-10-29 Thread Brendan Barnwell
I encountered a strange error when trying to put some annotations on 
a graph.  I was able to simplify it to this:

pyplot.plot([1, 2, 3, 4], [0, -1, -2, 8])
pyplot.annotate("Blah", xy=(2, 2), xytext=(-20,-20), 
textcoords='offset points',
 bbox=dict(boxstyle='round,pad=0.5'),
 arrowprops=dict(arrowstyle='fancy', 
connectionstyle='arc3,rad=0'))

On my system (matplotlib 1.1.0 with Python 2.6 on Windows XP), this 
causes a long traceback culminating in

File "C:\Program Files\Python\lib\site-packages\matplotlib\bezier.py", 
line 129, in find_bezier_t_intersecting_with_closedpath
 raise ValueError("the segment does not seemed to intersect with 
the path")

Increasing the xytext coordinates (in absolute value), to for 
instance (-50, -50) works with no error, and it also works without the 
special bbox style.  Just guessing from the error message, it looks 
like certain combinations of fancy patches are causing problems 
because the shapes don't intersect in the way the drawing code assumes 
they should.

I don't see anything in the docs about such edge cases, so this looks 
like a bug.  Judging from the way that small tweaks to the code can 
cause the error to disappear, I imagine it could be tricky to fix, but 
at the least there should probably be a warning in the docs that some 
kinds of anootation boxes won't work with some kinds of arrows when 
the text is too close to the annotated point.

Any ideas?

Thanks.
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World™ now supports Android™ Apps 
for the BlackBerry® PlayBook™. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Histogram of categorical values

2011-07-09 Thread Brendan Barnwell
Does matplotlib have a convenient way to produce a histogram of 
categorical (possibly non-numeric) values?  I can do it with bar(), 
but there's a fair amount of boilerplate involved (calculating the 
frequencies, counting the number of distinct values, etc.).  This 
seems like it would be a common task, so I'm wondering if there's a 
function for it, or, failing that, a standard recipe.

Thanks,
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc

2011-05-11 Thread Brendan Barnwell
[Accidentally sent this reply privately the first time, natch.]

On 2011-05-11 04:29, Jae-Joon Lee wrote:
 > > On Wed, May 11, 2011 at 5:03 PM, Daniel Mader
 > >   wrote:
 >> >>  Hi Jae-Loon,
 >> >>
 >> >>  thanks for your comments! Of course I do agree that a figure 
layout
 >> >>  should not change in interactive mode. However, I don't see 
why this
 >> >>  should happen upon a panning action. A different case is when the
 >> >>  label or title font sizes are changed, but I was assuming this is
 >> >>  adjusted prior to the creation of the figure.
 >> >>
 > >
 > > Since you said the current design is broken, I thought you want 
things
 > > adjusted *whenever* a figure is updated.
 > >
 > > So, I guess what you want is some functionality like what Tony's 
script does?
 > > One of the reason that I was not very inclined to Tony's approach is
 > > that it only works for subplots (and I guess it only works with
 > > subplots with pure n x m grid. Correct me if I'm wrong). But maybe it
 > > is better than nothing. I'll consider how things can be improved.

One thing I've always wondered: is it fundamentally impossible to
change the fact that, in matplotlib, you cannot know how big a drawn
object will be until you actually draw it?  When I was doing some
animation stuff a while back this caused me a lot of headache, for the
reasons Tony Yu mentioned: it means you have to draw everything
multiple times.  It would really help if it were possible to specify
objects' parameters and get their sizes without drawing them.

-- Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no 
path, and leave a trail." --author unknown

--
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] savefig bbox_inches='tight' does not consider suptitle

2011-03-07 Thread Brendan Barnwell
On 2011-03-07 08:59, Benjamin Root wrote:
> On Mon, Mar 7, 2011 at 10:33 AM, Yuri D'Elia  wrote:
>>  I was reading this at the time:
>>
>>  http://matplotlib.sourceforge.net/faq/usage_faq.html
>>
>>  I inferred pyplot was just a matlab-like interface on top of matplotlib,
>>  and figured using directly the matplotlib was acceptable.
>>
>
> Yeah, I am guessing that page is a little out-dated and could be better
> worded.  However, the page does say that the preferred style is the pyplot
> interface.  Also notice that it is extremely rare for any of the
> documentation to directly create the matplotlib objects without the pyplot
> or pylab interface.

I think this documentation should definitely be updated, then.  I've 
been using matplotlib a lot the last few months and was totally 
unaware that pyplot was "required".  Good thing I read this message! :-)

> The interface should create the figure objects, the figure objects should
> create the axes objects, the axes objects should create the axis objects,
> and so on and so forth.

That makes perfect sense, but is not at all what's implied by the 
text on the page linked above.

Best wishes,
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to blank an area of the canvas?

2010-02-16 Thread Brendan Barnwell
Jae-Joon Lee wrote:
>> I have added a bbox support for "restore_region", but I'm afraid
>> that this feature is not well tested. And I guess what you find
>> is, unfortunately,  a bug. While I'll try to push the changes to
>> the svn tomorrow, you may try to monkey-patch with following
>> code.


Thanks a lot, this seems to basically work.  For some reason the
bboxes are still restored at slightly the wrong place --- I have to
adjust them by one pixel in the y direction, but this is doable.

>> However, while matplotlib does support some animation, I think
>> you 'd better turn to another tool if you need an efficiency,

Maybe so.  What tool would you recommend for animated plots?

Best wishes,
-- Brendan Barnwell "Do not follow where the path may lead. Go,
instead, where there is no path, and leave a trail." --author unknown

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to blank an area of the canvas?

2010-02-14 Thread Brendan Barnwell
Brendan Barnwell wrote:
>   I'm trying to find the quickest way to erase a rectangular area of 
> the figure canvas.  I tried using canvas.restore_region with the 
> optional bbox argument, but there seems to be some mismatch between 
> the measurement units of the saved buffer object and the currently 
> shown data.  For instance, if I have a Text object on my plot, I tried 
> this:
> 
> bbox = g.text.get_window_extent()
> canvas.restore_region(background, bbox)
> 
> . . . but it does not correctly block out the text.  (The restored 
> rectangle from the background appears elsewhere on the axes.)  How can 
> I convert the buffer coordinates to the coordinates of the the 
> displayed plot?

I'm sorry to bump my own post, but I would really appreciate some 
help with this.  I've been wrestling with it for a couple days now, 
and I cannot figure out how the coordinate system of the saved canvas 
is related to the axes coordinates.  I have found that with 
bbox.transformed(ax.transData) I can at least get the coordinates 
scaled to fit on the axes, but they are still offset in position from 
where the box actually appears on the canvas.  I can't figure out how 
to compute this offset.

By playing around with the coordinates manually, for instance, I've 
found that adjusting x by -52 and y by 21 appears to line up the 
canvas with the axes, but I can't see where these numbers -52 and 21 
would come from.  My saved canvas buffer's get_extents() method 
returns (65, 50, 586, 443), so I thought that the appropriate offsets 
would be 65 and 50, but that doesn't work.

So, what coordinates (x1, y1, x2, y2) do I need to use in 
canvas.restore_region(savedBuffer, (x1, y1, x2, y2)) in order to 
restore precisely the area of canvas occupied by a patch drawn at axis 
coordinates (a1, b1, a2, b2)?

Thanks?
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to blank an area of the canvas?

2010-02-12 Thread Brendan Barnwell
I'm trying to find the quickest way to erase a rectangular area of 
the figure canvas.  I tried using canvas.restore_region with the 
optional bbox argument, but there seems to be some mismatch between 
the measurement units of the saved buffer object and the currently 
shown data.  For instance, if I have a Text object on my plot, I tried 
this:

bbox = g.text.get_window_extent()
canvas.restore_region(background, bbox)

. . . but it does not correctly block out the text.  (The restored 
rectangle from the background appears elsewhere on the axes.)  How can 
I convert the buffer coordinates to the coordinates of the the 
displayed plot?

I also tried creating a patch with the same bounds as the text bbox 
and adding it to the axes, but this seems to have no effect.  Do I 
have to do something besides ax.draw_artist(mypatch) to get it to draw?

This is part of the same thing I posted about a few days ago with 
trying to do an animation with many moving parts.  Are there any 
examples of animations which do not involve restoring the entire 
background with each draw, but rather individually erasing individual 
elements in the plot and redrawing them elsewhere?  That's what I'm 
trying to do here.

Thanks,
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Animation with many moving parts

2010-02-10 Thread Brendan Barnwell
I'm trying to do an animation which plots a large number of items on 
two dimensions, and then animates their positions over time.  I have 
set up the plot with my dimensions on the axes and am using 
canvas.blit (as shown in one of the examples) to update my plot.  I'm 
using text as the markers --- that is, I use the text function to 
display the label of each item (not just a point) at its location on 
the graph.

The problem is that I have a large amount of data.  There are over 
100,000 "steps" in my time sequence (i.e., places where I might need 
to update the display because some item moved), and even though not 
all of those actually result in a change in the positions, there are 
still several thousand distinct items that need to be plotted and 
moved around.  I'm currently buffering this a bit so that I only 
update on every Nth data point, but it's still rather slow.

I can see one obvious, issue, but I'm not sure how to work around it. 
  The thing is that a large number of the items don't actually move 
around very much over time, and even if one does move around 
relatively frequently, there may be long stretches where it doesn't. 
Yet, on every display update, I am redrawing all 1000+ artists.  I 
feel like there should be some way to move only the points that need 
to be moved, but I'm not sure how to do it.  My idea for how to 
improve it is that, for each display update, I would look at which 
bits of text actually do need to move, look at where they currently 
are, calculate which other texts overlap with those moving, then blit 
a blank rectangle onto the "old" positions of the moving items, and 
redraw only the moving items and those that were partially erased by 
the blank.  This way items that were nowhere near any change wouldn't 
need to be redrawn.

Is this feasible?  Is there a standard way to go about this?  Is 
there any way to figure out which artists overlap without looping over 
the list of all artists and checking the bbox bounds?  Any other 
suggestions on how to do it?

Thanks,
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Importing pyplot crashes python

2010-01-23 Thread Brendan Barnwell
Brendan Barnwell wrote:
> Hi,
> 
>   I decided to upgrade to matoplotlib 0.99.1.  I'm on Windows XP.  I 
> downloaded matplotlib-0.99.1.win32-py2.5.exe and ran it.  It seemed to 
> install.  Now when I try "from matplotlib import pyplot", Python 
> crashes with one of those "pythonw has encountered a problem and needs 
> to close" messages.  I tried uninstalling matplotlib, and I also 
> uninstalled SciPy and upgraded that to the latest version (0.7.1) and 
> then reinstalled matplotlib.  Still crashes.  Importing numpy on its 
> own works, as does importing matplotlib on its own.
> 
>   How can I fix this problem?

I forgot to mention that I'm using Python 2.5.2.  Has anyone else 
encountered this problem?

Best wishes,
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Importing pyplot crashes python

2010-01-21 Thread Brendan Barnwell
Hi,

I decided to upgrade to matoplotlib 0.99.1.  I'm on Windows XP.  I 
downloaded matplotlib-0.99.1.win32-py2.5.exe and ran it.  It seemed to 
install.  Now when I try "from matplotlib import pyplot", Python 
crashes with one of those "pythonw has encountered a problem and needs 
to close" messages.  I tried uninstalling matplotlib, and I also 
uninstalled SciPy and upgraded that to the latest version (0.7.1) and 
then reinstalled matplotlib.  Still crashes.  Importing numpy on its 
own works, as does importing matplotlib on its own.

How can I fix this problem?

Thanks,
-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] basic understanding of plotting dates

2007-09-04 Thread Brendan Barnwell
Bill Dandreta wrote:
>>>C M wrote:
>> 1. What exactly must I import (which modules) and how do I import them
>> (in the sense of "import x" vs. "from x import y")?
>> 2. What arguments does the plot_date() command take and what is format
>> of the arguments?
>> 3. Do I have to make the conversion from the date format above to the
>> matplotlib date format?  If so, how?
> <<
> 
> The code snippet below should answer most of your questions.

Incidentally, is there a reason why matplotlib can't just handle 
datetime 
objects itself?  The requirement of having to manually convert them to an 
ad-hoc 
matplotlib "format" (which is just an integer) seems rather obtuse.

-- 
--Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no path, 
and leave a trail."
--author unknown

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Legend outside plot

2006-08-18 Thread Brendan Barnwell
Stefan van der Walt wrote:
> On Thu, Aug 17, 2006 at 09:48:58PM -0700, Brendan Barnwell wrote:
>> [I accidentally sent this message privately to the sender before. . . why 
>> doesn't this list set the Reply-To header to the list?]
> 
> I don't think mailing lists should change the reply-to:
> 
> http://www.unicom.com/pw/reply-to-harmful.html

As per the instructions on that page, I am sending this reply by using 
my 
client's "reply to all" feature.  If you receive two copies of this email (one 
from me and one from the list) then I suspect you will understand the 
disadvantage of this mechanism.

-- 
--Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no path, 
and leave a trail."
--author unknown

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Legend outside plot

2006-08-17 Thread Brendan Barnwell
[I accidentally sent this message privately to the sender before. . . why 
doesn't this list set the Reply-To header to the list?]

Darren Dale wrote:

>> On Wednesday 16 August 2006 02:26, Brendan Barnwell wrote:
>
>>>>Hi, I'm trying to get matplotlib to give me a plot where the legend is
>>>> outside the axes.
>>>>
>>>>I saw several posts about this in the mailing list archives, but none of
>>>> them really seem to provide workable solutions.  
>
>> 
>> Try passing the loc kwarg to legend(). Like legend([...], loc=(1.01, 0.25))

Thanks, that works after a fashion.  Again, though, I can't figure out a
programmatic way to decide what values to use there.  I would like to be able to
calculate the size of the window, calculate the size of the legend, and then set
the size of the axes so that everything fits nicely.

Why is it that the sizes and positions for axes and legends are 
specified in
totally different units (proportional vs. pixel)?  Is there a way to say "I want
the axes to take up 80% of the window and the legend to take up the remaining
20%"?  Is there a way to change the format of the legend, so that it is, for
example, in two columns instead of one?  Or to get the legend text to word wrap
within a fixed-width box instead of just causing the legend box to grow without
bound?  What I'm trying to do is figure out how to programmatically arrange the
various elements in the plot window so that they look nice.

I guess the simplest question I can ask is: how can I getthe width of 
the 
legend and the width of the axes in comparable units?  If I could at least get 
that, I could manually calculate how big the axes should be.


>>>> Or, alternatively, is there some easier way to get legends to NEVER
>>>> overlap lines?
>
>> 
>> try legend([...], loc='best')

    That doesn't work, because 'best' apparently isn't implemented for 
figure
legends, and if I use an axes legend then it sometimes overlaps the lines.

-- --Brendan Barnwell "Do not follow where the path may lead. Go, instead, 
where 
there is no path, and leave a trail." --author unknown

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Legend outside plot

2006-08-15 Thread Brendan Barnwell
Hi, I'm trying to get matplotlib to give me a plot where the legend is 
outside 
the axes.

I saw several posts about this in the mailing list archives, but none 
of them 
really seem to provide workable solutions.  Using Figure.legend() doesn't 
really 
put the legend outside the figure, because it doesn't resize the axes, so the 
legend just overlaps the figure.

In the spirit of open source, I thought I'd try to do it myself.  But I 
can't 
even figure out how the various matplotlib objects are being positioned in the 
window.  Like, I can get some info about the axes with axes.get_position(), and 
I can get some info about the legend with 
legend.get_window_extent().get_bounds(), but the former is just proportional 
size information relative to the figure as a whole, and the second is in some 
coordinates I don't know how to interpret.  How can I get information about the 
bounding boxes of the actual plot (i.e., the axes and plot area including ticks 
and labels) and the legend, in compatible numbers that will allow me to 
determine whether they overlap?

Or, alternatively, is there some easier way to get legends to NEVER 
overlap 
lines?  I'm rather surprised that there seems to be no way to guarantee this, 
since it seems like an obvious thing to want, and also since there seem to be a 
bunch of requests for it on the mailing list.

    Thanks for the help.

-- 
--Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no path, 
and leave a trail."
--author unknown

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users