Re: [Matplotlib-users] custom markers from images?

2012-03-02 Thread C M
> Right.  It should be technically feasible to just simply tell figimage to
> use a different transformation object, but this might have implications
> elsewhere.  I am very hazy in this part of mpl.
>

Hmm, I've simplified the figimage to just this line:

fig.figimage(im,100,100,origin="upper", transform=None)

And it puts the image 100 up and 100 px out from the lower right corner.  I
then tried setting the transform from None to all the various possible
transforms listed on this page:

http://matplotlib.sourceforge.net/users/transforms_tutorial.html

as well as their inverted() forms.  None of them allowed the image to be
updated with data coordinates when the plot was resized.

It really seems that figimage is a property of the figure only and not the
canvas, so whatever the axes do is irrelevant to its placement.

But I really don't know for sure.  So far, this isn't going to work this
way.

Thanks,
Che
--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Converting example from Gallery to suite X Y axis

2012-03-02 Thread phils

Hello
Found the example below and looks ideal for what I want with 2 exceptions.
I want the x axis to have a time period of say 12 months and y axis no's of
USD values.
So, the data is like..
Jan 2011 100034
Feb2011  345321
Mar 2011 785434
Apr 2011 523753
May 2011346723
etc etc

the code I found is and as a newbie tried and failed to convert .
Help appreciated

import numpy as npy
from pylab import figure, show
from matplotlib.widgets import SpanSelector
 
fig = figure(figsize=(8,6))
ax = fig.add_subplot(211, axisbg='#CC')
 
x = npy.arange(0.0, 5.0, 0.01)
y = npy.sin(2*npy.pi*x) + 0.5*npy.random.randn(len(x))

ax.plot(x, y, '-')
ax.set_ylim(-2,2)
ax.set_title('Press left mouse button and drag to test')

ax2 = fig.add_subplot(212, axisbg='#CC')
line2, = ax2.plot(x, y, '-')
 
def onselect(xmin, xmax):
indmin, indmax = npy.searchsorted(x, (xmin, xmax))
indmax = min(len(x)-1, indmax)
thisx = x[indmin:indmax]
thisy = y[indmin:indmax]
line2.set_data(thisx, thisy)
ax2.set_xlim(thisx[0], thisx[-1])
ax2.set_ylim(thisy.min(), thisy.max())
fig.canvas.draw() 

# set useblit True on gtkagg for enhanced performance
span = SpanSelector(ax, onselect, 'horizontal', useblit=True,
rectprops=dict(alpha=0.5, facecolor='red') )

show()

 
-- 
View this message in context: 
http://old.nabble.com/Converting-example-from-Gallery-to-suite-X-Y-axis-tp33431805p33431805.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib hanging on Mac OS 10.7 with Python 2.7.2 EPD 7.2-2 (64-bit)

2012-03-02 Thread Jean-Baptiste Marquette

Aloha Eric,

> This appears to be very much a dueling event loop problem.  My guess is 
> that the solution will have to be something that keeps the event loops 
> well separated, probably in separate processes.  All interaction with 
> your Client event loop would be in one process, and the callback would 
> get your data and put it somewhere (e.g. in a numpy npz file). Then the 
> trick is to have the matplotlib process in a polling loop using a timer 
> (done crudely with plt.pause(0.1); there is probably a better way) 
> checking to see if that "somewhere" has been updated, and if so, 
> updating its plot.

I feel I see the light at the end of the tunnel. The npz file is even not 
necessary, I just need to pass the star id to a separate plotting process, to 
be compared to some stored previous value, in order to refresh the plot.
I have to think about it for a couple of days…

Thanks for the suggestion,
Cheers,
JB--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib hanging on Mac OS 10.7 with Python 2.7.2 EPD 7.2-2 (64-bit)

2012-03-02 Thread Eric Firing
On 03/02/2012 01:16 AM, Jean-Baptiste Marquette wrote:
>
> Hi Ben,
>
>> You have several possible sources of problems here. I would first make
>> sure that basic matplotlib scripts work using the Qt4Agg backend on
>> your computer. Test out some regular scripts from the examples section
>> of the documentation. If they work as expected, then it is probably
>> more likely that there is a problem with one of the other libraries.
>
> Good point. Tests successful.
>
>> Another possible source of trouble may lie with the calls to "sleep".
>> Because the display libraries are not on a separate process, the sleep
>> could also prevent the figures from being completely rendered.
>>
>> Personally, I wouldn't even bother with the interactive mode. Keep it
>> off, and just put the cleanup code after "plt.show()", which is a
>> blocking call. There is no need to implement your own event loop.
>
> The challenge is to display hundreds of stellar light curves by
> sequently selecting rows in a table through the SAMP mechanism. Thus it
> would be fine not to have to kill the plot window after each display,
> but to have it automatically refreshed after each row selection (I'm a
> lazy guy…).
> I just commented the plt.ion() line, this yields a segmentation fault,
> here is the crash report.

This appears to be very much a dueling event loop problem.  My guess is 
that the solution will have to be something that keeps the event loops 
well separated, probably in separate processes.  All interaction with 
your Client event loop would be in one process, and the callback would 
get your data and put it somewhere (e.g. in a numpy npz file). Then the 
trick is to have the matplotlib process in a polling loop using a timer 
(done crudely with plt.pause(0.1); there is probably a better way) 
checking to see if that "somewhere" has been updated, and if so, 
updating its plot.

Eric

>
> Cheers
> JB
>


--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Move the content of a figure into a subplot of this figure.

2012-03-02 Thread John Hunter
On Fri, Mar 2, 2012 at 4:57 AM, Guillaume Gay  wrote:

> Hi list,
>
> I am trying to implement some GUI tools in matplotlib - more precisely a
> line profile tool and a contrast setter which I hope will be integrated to
> the skimage kit [see https://github.com/glyg/**scikits-image/blob/master/*
> *skimage/io/_plugins/**matplotlib_plugin.py].
>
>
> Now here is my question:
> Is it possible to grab  the content of a figure and 'displace' it in a
> subplot of the same figure, to give room for a knew plot - even if the
> original content is complex (i.e. an image + a colorbar + an histogram, for
> example).
>
> I am not sure I'm clear here, so I can try to rephrase if needed.
>
>
I am not sure if you are trying to move objects from one axes to another or
merely reposition an existing axes to make room for a new one.


Both are possible, but the latter is easy.  Each axes has [left, bottom,
width, height] rectangle in (0,1) figure coordinates that you can adjust at
any time.  See for example the subplots_adjust tool on the navigation
toolbar next to the save icon

http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_position

If you are working with subplots, also see the  change_geometry method

http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry

colorbars are a little tricky, because there you are needing to reposition
*two* axes, one for the image, and one for the colorbar itself.  You can do
this manually, but you probably want to look at JJ's gridspec and axes_grid
tools for laying out groups of axes:

http://matplotlib.sourceforge.net/users/gridspec.html
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/index.html#toolkit-axesgrid-index

JDH
--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting the bin content of a histogram

2012-03-02 Thread EnderWiggin

Hi Jeff,

thank you for your answer. It was very helpful to me.

Have a nice weekend!
-Jan
-- 
View this message in context: 
http://old.nabble.com/Setting-the-bin-content-of-a-histogram-tp33412466p33428602.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Move the content of a figure into a subplot of this figure.

2012-03-02 Thread Antoine Sirinelli
Hi,

you should be able to do so. In the past, I had written a small GUI that
had the ability to copy Line2D, images and text elements from an axe to
any other axes (even on different figure). This was integrated into GUI
used to change the line properties. It is a bit old and dirty but you
can find it there:
http://mpl-properties.googlecode.com/svn/trunk/mpl_properties.py

look for the "do_copy" function.

Antoine

On Fri, 2012-03-02 at 11:57 +0100, Guillaume Gay wrote:
> Hi list,
> 
> I am trying to implement some GUI tools in matplotlib - more precisely a 
> line profile tool and a contrast setter which I hope will be integrated 
> to the skimage kit [see 
> https://github.com/glyg/scikits-image/blob/master/skimage/io/_plugins/matplotlib_plugin.py].
>  
> 
> 
> Now here is my question:
> Is it possible to grab  the content of a figure and 'displace' it in a 
> subplot of the same figure, to give room for a knew plot - even if the 
> original content is complex (i.e. an image + a colorbar + an histogram, 
> for example).
> 
> I am not sure I'm clear here, so I can try to rephrase if needed.
> 
> Thanks
> 
> Guillaume
> --
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing 
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> ___ Matplotlib-users mailing list 
> Matplotlib-users@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Move the content of a figure into a subplot of this figure.

2012-03-02 Thread Guillaume Gay

Hi list,

I am trying to implement some GUI tools in matplotlib - more precisely a 
line profile tool and a contrast setter which I hope will be integrated 
to the skimage kit [see 
https://github.com/glyg/scikits-image/blob/master/skimage/io/_plugins/matplotlib_plugin.py]. 



Now here is my question:
Is it possible to grab  the content of a figure and 'displace' it in a 
subplot of the same figure, to give room for a knew plot - even if the 
original content is complex (i.e. an image + a colorbar + an histogram, 
for example).


I am not sure I'm clear here, so I can try to rephrase if needed.

Thanks

Guillaume
<>--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users