Re: [Matplotlib-users] sharex with one figure aspect = 1.0

2015-04-08 Thread Eric Firing
On 2015/04/08 11:15 AM, Jody Klymak wrote:
> Hi Eric,
>
>>> import matplotlib.pyplot as plt
>>> fig, axes = plt.subplots(nrows=2,sharex=True)
>>> axes[0].set_aspect(1.)
>>> axes[0].plot(np.arange(10),np.arange(10))
>>> axes[0].set_ylim([0,24])
>>> axes[0].set_xlim([0,12])
>>> axes[1].plot(np.arange(10),np.arange(10)*2.)
>>> plt.show()
>>>
>>> does not work as I'd expect.  axes[0]'s ylim gets changed so that the
>>> line is no longer viewable (= 10-14).  In my opinion, the two calls
>>> should work the same, except in the second case, axes[1]'s xlim
>>> should be 0-12.
>>>
>>
>> If you leave out the set_ylim call, it works.  Given that you have
>> specified set_ylim[0, 24], how is mpl supposed to know what ylim range
>> you really want, when the axis constraint means it can only plot a
>> small part of the specified range?
>
> It doesn't for me:
>
> import matplotlib.pyplot as plt
> fig, axes = plt.subplots(nrows=2,sharex=True)
> axes[0].set_aspect(1.)
> axes[0].plot(np.arange(10),np.arange(10))
> axes[1].plot(np.arange(10),np.arange(10)*2.)
> plt.show()
>
> still curtails the y limit in axes[0], in my case from ~2.9 to ~6.1 (see
> attached).

Jody, you told it you want x to go from 0 to 12, and have an aspect 
ratio of 1.  It is doing exactly that.  Are you expecting it to override 
your xlim specification?

>
>> Basically, you have set up conflicting constraints, and mpl failed
>> to resolve the conflict the way you think it should have.  Maybe that
>> could be improved, but I warn you, it's a tricky business.  Squeeze in
>> one place and things pop out somewhere else.
>
> I'm not clear what the conflicting constraints are.  There seems to be
> an unspoken one that sharex=True means the physical size of the axes
> must be the same. That constraint doesn't exist if sharex=False, and
> set_aspect() works as expected.  I'm questioning the unspoken
> constraint, and questioning why set_aspect() (or looking at the code
> apply_aspect()) needs to know about shared axes at all.  No doubt there
> is a use case I'm missing...

Yes, sharex=True means the x-axis is identical.  It's shared.  That's 
just what it means, and what it has always meant.  That's what it is 
for--to lock together the x axes of two or more Axes.

>
> I *can* see the issue if we think setting aspect ratios should *not*
> change the size of the axes, because changing the aspect ratio changes
> the data limits and then you have a problem checking all the shared axes
> to see which one has the largest data limits.  Its particularly
> problematic because I think that apply_aspect() is only called at
> draw()-time.  That seems a hard problem, but I'm not sure what the use
> case is for it, so I have trouble wrapping my head around it.

The use case for what--calling apply_aspect at draw time?  That's the 
only time it knows everything it needs to know in the general case, when 
there might be pan/zoom/reshape events.

Eric

>
> Thanks,   Jody
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>
>
>
> --
> 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
>


--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Jody Klymak
Hi Eric,

>> import matplotlib.pyplot as plt
>> fig, axes = plt.subplots(nrows=2,sharex=True)
>> axes[0].set_aspect(1.)
>> axes[0].plot(np.arange(10),np.arange(10))
>> axes[0].set_ylim([0,24])
>> axes[0].set_xlim([0,12])
>> axes[1].plot(np.arange(10),np.arange(10)*2.)
>> plt.show()
>> 
>> does not work as I'd expect.  axes[0]'s ylim gets changed so that the line 
>> is no longer viewable (= 10-14).  In my opinion, the two calls should work 
>> the same, except in the second case, axes[1]'s xlim should be 0-12.
>> 
> 
> If you leave out the set_ylim call, it works.  Given that you have specified 
> set_ylim[0, 24], how is mpl supposed to know what ylim range you really want, 
> when the axis constraint means it can only plot a small part of the specified 
> range?  

It doesn't for me:

import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=2,sharex=True)
axes[0].set_aspect(1.)
axes[0].plot(np.arange(10),np.arange(10))
axes[1].plot(np.arange(10),np.arange(10)*2.)
plt.show()

still curtails the y limit in axes[0], in my case from ~2.9 to ~6.1 (see 
attached).

> Basically, you have set up conflicting constraints, and mpl failed to resolve 
> the conflict the way you think it should have.  Maybe that could be improved, 
> but I warn you, it's a tricky business.  Squeeze in one place and things pop 
> out somewhere else.

I'm not clear what the conflicting constraints are.  There seems to be an 
unspoken one that sharex=True means the physical size of the axes must be the 
same. That constraint doesn't exist if sharex=False, and set_aspect() works as 
expected.  I'm questioning the unspoken constraint, and questioning why 
set_aspect() (or looking at the code apply_aspect()) needs to know about shared 
axes at all.  No doubt there is a use case I'm missing...

I *can* see the issue if we think setting aspect ratios should *not* change the 
size of the axes, because changing the aspect ratio changes the data limits and 
then you have a problem checking all the shared axes to see which one has the 
largest data limits.  Its particularly problematic because I think that 
apply_aspect() is only called at draw()-time.  That seems a hard problem, but 
I'm not sure what the use case is for it, so I have trouble wrapping my head 
around it. 

Thanks,   Jody


--
Jody Klymak
http://web.uvic.ca/~jklymak/





--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Eric Firing
On 2015/04/08 8:43 AM, Jody Klymak wrote:
> Hi Eric,
>
>> On 8 Apr 2015, at  11:02 AM, Eric Firing  wrote:
>>
>> I'm the guilty party for most of how set_aspect works.  I developed it a
>> long time ago. Yes, there was a reason--still is, I'm 99% sure--but I
>> don't remember everything, and don't want to take the time now to
>> reconstruct the whole rationale.  When I was developing the behavior, I
>> was paying a lot of attention to what happens under various scenarios of
>> resizing and reshaping the window, and turning options on and off.
>> There are some basic conflicts that arise when shared axes are combined
>> with fixed aspect ratios, autoscaling, and gui-driven reshaping.
>> Sometimes 'box-forced' does what people want, maybe more often than not;
>> but I'm pretty sure it can lead to trouble, which is the reason it is
>> not the default.
>
> OK, first my apologies:
>
> import matplotlib.pyplot as plt
> fig, axes = plt.subplots(nrows=2)
> axes[0].set_aspect(1.)
> axes[0].plot(np.arange(10),np.arange(10))
> axes[0].set_ylim([0,24])
> axes[0].set_xlim([0,12])
> axes[1].plot(np.arange(10),np.arange(10)*2.)
> plt.show()
>
> Works as I'd expect.  axes[0] gets shrunk in the x dimension to make the 
> aspect ratio 1.
>
> However:
>
> import matplotlib.pyplot as plt
> fig, axes = plt.subplots(nrows=2,sharex=True)
> axes[0].set_aspect(1.)
> axes[0].plot(np.arange(10),np.arange(10))
> axes[0].set_ylim([0,24])
> axes[0].set_xlim([0,12])
> axes[1].plot(np.arange(10),np.arange(10)*2.)
> plt.show()
>
> does not work as I'd expect.  axes[0]'s ylim gets changed so that the line is 
> no longer viewable (= 10-14).  In my opinion, the two calls should work the 
> same, except in the second case, axes[1]'s xlim should be 0-12.
>

If you leave out the set_ylim call, it works.  Given that you have 
specified set_ylim[0, 24], how is mpl supposed to know what ylim range 
you really want, when the axis constraint means it can only plot a small 
part of the specified range?  Basically, you have set up conflicting 
constraints, and mpl failed to resolve the conflict the way you think it 
should have.  Maybe that could be improved, but I warn you, it's a 
tricky business.  Squeeze in one place and things pop out somewhere else.

Eric

> Even worse, if I use the same aspect ratio in axes[1], they *both* do not 
> show all the data:
>
> axes[0].set_aspect(1.)
>
> It appears here that with sharex=True the shape of the axis no longer becomes 
> mutable when set_aspect() is used, whereas if sharex=False set_aspect() can 
> change the axis shape. I don't see any reason for sharex to foist this 
> behaviour onto set_aspect().
>
> I guess the workaround is don't use sharex=True, but I actually think this is 
> a bug.
>
> Thanks,   Jody
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>


--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Jody Klymak
Hi Eric,

> On 8 Apr 2015, at  11:02 AM, Eric Firing  wrote:
> 
> I'm the guilty party for most of how set_aspect works.  I developed it a 
> long time ago. Yes, there was a reason--still is, I'm 99% sure--but I 
> don't remember everything, and don't want to take the time now to 
> reconstruct the whole rationale.  When I was developing the behavior, I 
> was paying a lot of attention to what happens under various scenarios of 
> resizing and reshaping the window, and turning options on and off. 
> There are some basic conflicts that arise when shared axes are combined 
> with fixed aspect ratios, autoscaling, and gui-driven reshaping. 
> Sometimes 'box-forced' does what people want, maybe more often than not; 
> but I'm pretty sure it can lead to trouble, which is the reason it is 
> not the default.

OK, first my apologies:

import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=2)
axes[0].set_aspect(1.)
axes[0].plot(np.arange(10),np.arange(10))
axes[0].set_ylim([0,24])
axes[0].set_xlim([0,12])
axes[1].plot(np.arange(10),np.arange(10)*2.)
plt.show()

Works as I'd expect.  axes[0] gets shrunk in the x dimension to make the aspect 
ratio 1.

However:

import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=2,sharex=True)
axes[0].set_aspect(1.)
axes[0].plot(np.arange(10),np.arange(10))
axes[0].set_ylim([0,24])
axes[0].set_xlim([0,12])
axes[1].plot(np.arange(10),np.arange(10)*2.)
plt.show()

does not work as I'd expect.  axes[0]'s ylim gets changed so that the line is 
no longer viewable (= 10-14).  In my opinion, the two calls should work the 
same, except in the second case, axes[1]'s xlim should be 0-12.  

Even worse, if I use the same aspect ratio in axes[1], they *both* do not show 
all the data: 

axes[0].set_aspect(1.)

It appears here that with sharex=True the shape of the axis no longer becomes 
mutable when set_aspect() is used, whereas if sharex=False set_aspect() can 
change the axis shape. I don't see any reason for sharex to foist this 
behaviour onto set_aspect().  

I guess the workaround is don't use sharex=True, but I actually think this is a 
bug.  

Thanks,   Jody

--
Jody Klymak
http://web.uvic.ca/~jklymak/






--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Eric Firing
On 2015/04/08 7:04 AM, Jody Klymak wrote:
> Maybe there is a reason for the default, but I really think the data
> view should be prioritized over the shape of the axis.

I forgot to include: I was trying to make everything sane (and 
reversible) under zoom and pan as well as reshaping and resizing.

--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Eric Firing
On 2015/04/08 7:04 AM, Jody Klymak wrote:
> Following up on this, I’d like to complain about set_aspect()…
>
> If I do:
>
> import matplotlib.pyplot as plt
> fig, axes = plt.subplots(nrows=2,sharex=True)
> axes[0].set_ylim(0,1.)
> axes[0].set_aspect(1.)
> plt.show()
>
> the x-axis goes from 0. to 1., but axes[0]’s y-axis goes from 0.32 to
> 0.67.  Swapping the order of the y_lim call doesn’t help.  This is very
> un-intuitive, as I’d expect set_ylim() to set what data I see no matter
> what else is happening w/ the plot.
>
> I see that
> axes[0].set_aspect(1.,adjustable=‘box-forced’)
> will give the desired behaviour, but I really think it should be the
> default, not adjustable=‘datalim'.  I had no idea set_aspect() had this
> parameter until today, and have had several cursing matches with
> set_aspect as it kept changing my explicitly set data limits. set_ylim()
> should set the y limits.
>
> Just my opinion.  Maybe there is a reason for the default, but I really
> think the data view should be prioritized over the shape of the axis.

Jody,

I'm the guilty party for most of how set_aspect works.  I developed it a 
long time ago. Yes, there was a reason--still is, I'm 99% sure--but I 
don't remember everything, and don't want to take the time now to 
reconstruct the whole rationale.  When I was developing the behavior, I 
was paying a lot of attention to what happens under various scenarios of 
resizing and reshaping the window, and turning options on and off. 
There are some basic conflicts that arise when shared axes are combined 
with fixed aspect ratios, autoscaling, and gui-driven reshaping. 
Sometimes 'box-forced' does what people want, maybe more often than not; 
but I'm pretty sure it can lead to trouble, which is the reason it is 
not the default.

Eric

>
> Thanks,   Jody
>


--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Jody Klymak
Following up on this, I’d like to complain about set_aspect()…

If I do:

import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=2,sharex=True)
axes[0].set_ylim(0,1.)
axes[0].set_aspect(1.)
plt.show()

the x-axis goes from 0. to 1., but axes[0]’s y-axis goes from 0.32 to 0.67.  
Swapping the order of the y_lim call doesn’t help.  This is very un-intuitive, 
as I’d expect set_ylim() to set what data I see no matter what else is 
happening w/ the plot.

I see that 
axes[0].set_aspect(1.,adjustable=‘box-forced’)
will give the desired behaviour, but I really think it should be the default, 
not adjustable=‘datalim'.  I had no idea set_aspect() had this parameter until 
today, and have had several cursing matches with set_aspect as it kept changing 
my explicitly set data limits. set_ylim() should set the y limits.   

Just my opinion.  Maybe there is a reason for the default, but I really think 
the data view should be prioritized over the shape of the axis.

Thanks,   Jody


> On 8 Apr 2015, at  5:53 AM, Thomas Caswell  wrote:
> 
> What version had this behavior?  I recall some work on how aspect worked, but 
> not exactly what we did.  I see why it is useful, but on the other hand that 
> sort of coupling seems like could cause some trouble if we are not careful.  
> This all come back to we need a real layout manager/constraint solver (which 
> no one has yet had time to address).
> 
> For now I think this will do what you want:
> 
> import numpy as np
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid1 import make_axes_locatable
> 
> fig, ax_top = plt.subplots()
> ax_top.set_aspect(1)
> divider = make_axes_locatable(ax_top)
> bax_bottom = divider.append_axes('bottom', 1, pad=0.1,
>  sharex=ax_top)
> 
> 
> Please don't use `plt.setp`, it is a MATLABism that I think is past it's time.
> 
> On Wed, Apr 8, 2015 at 8:21 AM Mark Bakker  > wrote:
> import matplotlib.pyplot as plt
> %matplotlib qt
> fig, axes = plt.subplots(nrows=2,sharex=True)
> plt.setp(axes[0], aspect=1.0, adjustable='box-forced')
> plt.show()
> 
> This used to create two axes of the same horizontal size. What it does now is 
> that it scales the upper axis so that the aspect=1.0 by changing the physical 
> size of the axis. But the physical size of the lower axis is not changed, 
> while this used to be the case in the past (but that may have been a few 
> years back). That sure used to be the desired behavior.
> 
> Thanks for your help,
> 
> Mark
> 
> 
> 
> On Wed, Apr 8, 2015 at 2:16 PM, Thomas Caswell  > wrote:
> Can you please provide a minimal, but complete and runnable example of what 
> you are doing?
> 
> 
> On Wed, Apr 8, 2015, 08:13 Mark Bakker  > wrote:
> Thanks, Thomas.
> 
> That works indeed, but it doesn't make the figure adjustable, which is what I 
> wanted (that the physical size of the axes changes while the aspect ratio is 
> fixed to 1). I guess that functionality has been taken out. 
> 
> Mark
> 
> On Wed, Apr 8, 2015 at 12:50 PM, Thomas Caswell  > wrote:
> What are the data limits you are using?
> 
> I suspect they you are over constraining the system/order of operations 
> issue. Try dropping the adjustable setting and pre setting both the data 
> limits and the approximate size in figure fraction (ex via grid spec) of the 
> axes.
> 
> Tom
> 
> 
> On Tue, Apr 7, 2015, 15:54 Mark Bakker  > wrote:
> Hello list,
> 
> I want to axes above each other. They share the x-axis. The top figure has 
> 'aspect=1' (it is a map), the bottom figure shows a cross-section along a 
> horizontal line on the map, so it doesn't have 'aspect=1'. When I do this 
> with code, for example like this:
> 
> fig, axes = plt.subplots(nrows=2,sharex=True)
> plt.setp(axes[0], aspect=1.0, adjustable='box-forced')
> 
> then the physical size of the top axes is much sorter than the physical size 
> of the bottom axes (although they are poperly linked, as they have the same 
> data limit, and when zooming in the top figure, the bottom figure adjusts). 
> It just looks weird, as the size of the horizontal axis of the bottom figure 
> should have the same physical size as the horizontal axis of the top figure. 
> This used to be possible (a few years ago; haven't tried it for a while). Is 
> there a way to do it with the current matpotlib? (1.4.3)
> 
> Thanks,
> 
> Mark
> --
> 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_

Re: [Matplotlib-users] sharex with one figure aspect = 1.0

2015-04-08 Thread Thomas Caswell
What version had this behavior?  I recall some work on how aspect worked,
but not exactly what we did.  I see why it is useful, but on the other hand
that sort of coupling seems like could cause some trouble if we are not
careful.  This all come back to we need a real layout manager/constraint
solver (which no one has yet had time to address).

For now I think this will do what you want:

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable

fig, ax_top = plt.subplots()
ax_top.set_aspect(1)
divider = make_axes_locatable(ax_top)
bax_bottom = divider.append_axes('bottom', 1, pad=0.1,
 sharex=ax_top)


Please don't use `plt.setp`, it is a MATLABism that I think is past it's
time.

On Wed, Apr 8, 2015 at 8:21 AM Mark Bakker  wrote:

> import matplotlib.pyplot as plt
> %matplotlib qt
> fig, axes = plt.subplots(nrows=2,sharex=True)
> plt.setp(axes[0], aspect=1.0, adjustable='box-forced')
> plt.show()
>
> This used to create two axes of the same horizontal size. What it does now
> is that it scales the upper axis so that the aspect=1.0 by changing the
> physical size of the axis. But the physical size of the lower axis is not
> changed, while this used to be the case in the past (but that may have been
> a few years back). That sure used to be the desired behavior.
>
> Thanks for your help,
>
> Mark
>
>
>
> On Wed, Apr 8, 2015 at 2:16 PM, Thomas Caswell  wrote:
>
>> Can you please provide a minimal, but complete and runnable example of
>> what you are doing?
>>
>> On Wed, Apr 8, 2015, 08:13 Mark Bakker  wrote:
>>
>>> Thanks, Thomas.
>>>
>>> That works indeed, but it doesn't make the figure adjustable, which is
>>> what I wanted (that the physical size of the axes changes while the aspect
>>> ratio is fixed to 1). I guess that functionality has been taken out.
>>>
>>> Mark
>>>
>>> On Wed, Apr 8, 2015 at 12:50 PM, Thomas Caswell 
>>> wrote:
>>>
 What are the data limits you are using?

 I suspect they you are over constraining the system/order of operations
 issue. Try dropping the adjustable setting and pre setting both the data
 limits and the approximate size in figure fraction (ex via grid spec) of
 the axes.

 Tom

 On Tue, Apr 7, 2015, 15:54 Mark Bakker  wrote:

> Hello list,
>
> I want to axes above each other. They share the x-axis. The top figure
> has 'aspect=1' (it is a map), the bottom figure shows a cross-section 
> along
> a horizontal line on the map, so it doesn't have 'aspect=1'. When I do 
> this
> with code, for example like this:
>
> fig, axes = plt.subplots(nrows=2,sharex=True)
> plt.setp(axes[0], aspect=1.0, adjustable='box-forced')
>
> then the physical size of the top axes is much sorter than the
> physical size of the bottom axes (although they are poperly linked, as 
> they
> have the same data limit, and when zooming in the top figure, the bottom
> figure adjusts). It just looks weird, as the size of the horizontal axis 
> of
> the bottom figure should have the same physical size as the horizontal 
> axis
> of the top figure. This used to be possible (a few years ago; haven't 
> tried
> it for a while). Is there a way to do it with the current matpotlib? 
> (1.4.3)
>
> Thanks,
>
> Mark
> 
> --
> 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
>

>>>
>
--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Mark Bakker
import matplotlib.pyplot as plt
%matplotlib qt
fig, axes = plt.subplots(nrows=2,sharex=True)
plt.setp(axes[0], aspect=1.0, adjustable='box-forced')
plt.show()

This used to create two axes of the same horizontal size. What it does now
is that it scales the upper axis so that the aspect=1.0 by changing the
physical size of the axis. But the physical size of the lower axis is not
changed, while this used to be the case in the past (but that may have been
a few years back). That sure used to be the desired behavior.

Thanks for your help,

Mark



On Wed, Apr 8, 2015 at 2:16 PM, Thomas Caswell  wrote:

> Can you please provide a minimal, but complete and runnable example of
> what you are doing?
>
> On Wed, Apr 8, 2015, 08:13 Mark Bakker  wrote:
>
>> Thanks, Thomas.
>>
>> That works indeed, but it doesn't make the figure adjustable, which is
>> what I wanted (that the physical size of the axes changes while the aspect
>> ratio is fixed to 1). I guess that functionality has been taken out.
>>
>> Mark
>>
>> On Wed, Apr 8, 2015 at 12:50 PM, Thomas Caswell 
>> wrote:
>>
>>> What are the data limits you are using?
>>>
>>> I suspect they you are over constraining the system/order of operations
>>> issue. Try dropping the adjustable setting and pre setting both the data
>>> limits and the approximate size in figure fraction (ex via grid spec) of
>>> the axes.
>>>
>>> Tom
>>>
>>> On Tue, Apr 7, 2015, 15:54 Mark Bakker  wrote:
>>>
 Hello list,

 I want to axes above each other. They share the x-axis. The top figure
 has 'aspect=1' (it is a map), the bottom figure shows a cross-section along
 a horizontal line on the map, so it doesn't have 'aspect=1'. When I do this
 with code, for example like this:

 fig, axes = plt.subplots(nrows=2,sharex=True)
 plt.setp(axes[0], aspect=1.0, adjustable='box-forced')

 then the physical size of the top axes is much sorter than the physical
 size of the bottom axes (although they are poperly linked, as they have the
 same data limit, and when zooming in the top figure, the bottom figure
 adjusts). It just looks weird, as the size of the horizontal axis of the
 bottom figure should have the same physical size as the horizontal axis of
 the top figure. This used to be possible (a few years ago; haven't tried it
 for a while). Is there a way to do it with the current matpotlib? (1.4.3)

 Thanks,

 Mark
 
 --
 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

>>>
>>
--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Thomas Caswell
Can you please provide a minimal, but complete and runnable example of what
you are doing?

On Wed, Apr 8, 2015, 08:13 Mark Bakker  wrote:

> Thanks, Thomas.
>
> That works indeed, but it doesn't make the figure adjustable, which is
> what I wanted (that the physical size of the axes changes while the aspect
> ratio is fixed to 1). I guess that functionality has been taken out.
>
> Mark
>
> On Wed, Apr 8, 2015 at 12:50 PM, Thomas Caswell 
> wrote:
>
>> What are the data limits you are using?
>>
>> I suspect they you are over constraining the system/order of operations
>> issue. Try dropping the adjustable setting and pre setting both the data
>> limits and the approximate size in figure fraction (ex via grid spec) of
>> the axes.
>>
>> Tom
>>
>> On Tue, Apr 7, 2015, 15:54 Mark Bakker  wrote:
>>
>>> Hello list,
>>>
>>> I want to axes above each other. They share the x-axis. The top figure
>>> has 'aspect=1' (it is a map), the bottom figure shows a cross-section along
>>> a horizontal line on the map, so it doesn't have 'aspect=1'. When I do this
>>> with code, for example like this:
>>>
>>> fig, axes = plt.subplots(nrows=2,sharex=True)
>>> plt.setp(axes[0], aspect=1.0, adjustable='box-forced')
>>>
>>> then the physical size of the top axes is much sorter than the physical
>>> size of the bottom axes (although they are poperly linked, as they have the
>>> same data limit, and when zooming in the top figure, the bottom figure
>>> adjusts). It just looks weird, as the size of the horizontal axis of the
>>> bottom figure should have the same physical size as the horizontal axis of
>>> the top figure. This used to be possible (a few years ago; haven't tried it
>>> for a while). Is there a way to do it with the current matpotlib? (1.4.3)
>>>
>>> Thanks,
>>>
>>> Mark
>>> 
>>> --
>>> 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
>>>
>>
>
--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Mark Bakker
Thanks, Thomas.

That works indeed, but it doesn't make the figure adjustable, which is what
I wanted (that the physical size of the axes changes while the aspect ratio
is fixed to 1). I guess that functionality has been taken out.

Mark

On Wed, Apr 8, 2015 at 12:50 PM, Thomas Caswell  wrote:

> What are the data limits you are using?
>
> I suspect they you are over constraining the system/order of operations
> issue. Try dropping the adjustable setting and pre setting both the data
> limits and the approximate size in figure fraction (ex via grid spec) of
> the axes.
>
> Tom
>
> On Tue, Apr 7, 2015, 15:54 Mark Bakker  wrote:
>
>> Hello list,
>>
>> I want to axes above each other. They share the x-axis. The top figure
>> has 'aspect=1' (it is a map), the bottom figure shows a cross-section along
>> a horizontal line on the map, so it doesn't have 'aspect=1'. When I do this
>> with code, for example like this:
>>
>> fig, axes = plt.subplots(nrows=2,sharex=True)
>> plt.setp(axes[0], aspect=1.0, adjustable='box-forced')
>>
>> then the physical size of the top axes is much sorter than the physical
>> size of the bottom axes (although they are poperly linked, as they have the
>> same data limit, and when zooming in the top figure, the bottom figure
>> adjusts). It just looks weird, as the size of the horizontal axis of the
>> bottom figure should have the same physical size as the horizontal axis of
>> the top figure. This used to be possible (a few years ago; haven't tried it
>> for a while). Is there a way to do it with the current matpotlib? (1.4.3)
>>
>> Thanks,
>>
>> Mark
>> 
>> --
>> 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
>>
>
--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Thomas Caswell
What are the data limits you are using?

I suspect they you are over constraining the system/order of operations
issue. Try dropping the adjustable setting and pre setting both the data
limits and the approximate size in figure fraction (ex via grid spec) of
the axes.

Tom

On Tue, Apr 7, 2015, 15:54 Mark Bakker  wrote:

> Hello list,
>
> I want to axes above each other. They share the x-axis. The top figure has
> 'aspect=1' (it is a map), the bottom figure shows a cross-section along a
> horizontal line on the map, so it doesn't have 'aspect=1'. When I do this
> with code, for example like this:
>
> fig, axes = plt.subplots(nrows=2,sharex=True)
> plt.setp(axes[0], aspect=1.0, adjustable='box-forced')
>
> then the physical size of the top axes is much sorter than the physical
> size of the bottom axes (although they are poperly linked, as they have the
> same data limit, and when zooming in the top figure, the bottom figure
> adjusts). It just looks weird, as the size of the horizontal axis of the
> bottom figure should have the same physical size as the horizontal axis of
> the top figure. This used to be possible (a few years ago; haven't tried it
> for a while). Is there a way to do it with the current matpotlib? (1.4.3)
>
> Thanks,
>
> Mark
> 
> --
> 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
>
--
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] Qt4 Designer Example

2015-04-08 Thread Christian Ambros
Hi Ryan,
could you write down, as a tutorial, how you built the example with the qt 
designer?In the last hours I read all most everything what can be found on the 
issue of getting matplotlib running with pyqt5 and the designer but as you 
realized yourself, there is little to be found handy.
I'm stuck at a project, which has to use python3, and pyqt5 and am not allowed 
by my boss to fall back to pyqt4 or qt_compat. He wants to make sure that we 
use the latest revisions.
So I#m very pleased to read that someone already set food on this terrain. 
Qt5.4.1 is running and I installed PyQtdesingerplugins, in mind that they were 
written for PyQt4. Are they usable in 5? I added the env-variables to my 
bashrc, did get any changes shown in the designer. Of course I did a re-log-in 
to start fresh, but any changes were noteable.What possible ways of embedding 
matplotlib into a designer base pyqt5-gui else, are there?
cheers,Christian


 --
"A little learning never caused anyone's head to explode!"

"Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" 


 On Wednesday, February 18, 2015 11:59 PM, Ryan Nelson 
 wrote:
   

 Hello list,
A couple months ago, I spent quite a bit of time trying to figure out how to 
use Qt designer create a GUI with an embedded MPL window. Unfortunately, the 
Scipy cookbook page 
(http://wiki.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer) is 
very outdated. A recent post 
(http://matplotlib.1069221.n5.nabble.com/Re-Keep-list-of-figures-or-plots-and-flip-through-list-using-UI-td44961.html)
 brought up some questions about a use case very similar to mine, so I redid my 
example and was going to write a quick tutorial for the docs.
Unfortunately, I'm not a Qt guru, so I thought that I would ask on the list for 
some advice.  The OP and I were both interested in being able to have a list of 
figures that you could select from to change the plot window. The embedding 
examples in the docs create subclasses of FigureClass* and embed the plotting 
figure/axes/etc. This works but gets tricky, though, when trying to switch 
plots. Also, for interactive IPython work, I didn't like that the plotting 
objects were mixed in with all the QtGui.QWidget attributes, which makes 
introspective searching painful. My solution was to create a dictionary of 
matplotlib.figure.Figure objects that had all of the plotting stuff defined. 
Then when I select a new plot from the list, the old one is removed and a new 
FigureClass object is created using the selected Figure object. Has anyone else 
successfully done something like this? Is there a better way? Also, it seems if 
I zoom the current plot, change to a new plot, and change back, the zoom region 
is retained. Anyone know how to reset the zoom region?
Attached is my example: "window.py" is the Designer-created main window and 
"custommpl.py" is the subclass of the main window that I wrote. It's about as 
short as I could make it.

Thanks
Ryan


--
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=190641631&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


  --
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] Problem with errorbar and log axis

2015-04-08 Thread Markus Haider
Hi Jody,

Thank you very much for your help. You are right, this is what I wanted :-)

Cheers,
Markus

On 2015-04-07 23:33, Jody Klymak wrote:
> xerr is +/- relative to the data:
>
> *xerr*/*yerr*: [ scalar | N, Nx1, or 2xN array-like ]
>  If a scalar number, len(N) array-like object, or an Nx1
>  array-like object, errorbars are drawn at +/-value relative
>  to the data.
>
>  If a sequence of shape 2xN, errorbars are drawn at -row1
>  and +row2 relative to the data.
>
> I think you want:
>
> xdat=10**data_x_log
> ax.errorbar(10**data_x_log,data_y,xerr=[xdat-error_x_lower,error_x_upper-xdat],ls='',marker='o')
>
> Cheers,   Jody
>
>> On 7 Apr 2015, at  13:51 PM, Markus Haider  wrote:
>>
>> I have the error from a table which is in log units, and the error is
>> given to be symmetric in log space.
>>
>> Cheers,
>> Markus
>>
>> On 2015-04-07 16:40, Yuxiang Wang wrote:
>>> Typo - "standard deviation OR standard error of mean", not "OF".
>>>
>>> Sorry.
>>>
>>> Shawn
>>>
>>>
>>> On Tue, Apr 7, 2015 at 10:39 AM, Yuxiang Wang  wrote:
 If you error bars denote standard deviation of standard error of mean,
 shouldn't they be non-symmetric in log scale?

 Shawn

 On Tue, Apr 7, 2015 at 10:11 AM, Markus Haider  
 wrote:
> Hi,
>
> I am trying to make an errorbar plot with a logarithmic x-axis. I have
> symmetric errors in logspace, however if I plot them, the errors are not
> symmetric anymore, as you can see in the enclosed image. Am I
> misunderstanding something or is this a bug?
>
> Thanks for your help,
> Markus
>
> Here the code I used to produce the plot:
>
> import matplotlib.pyplot as plt
>
> import numpy as np
>
> data_x_log = np.array([13.0,15.0])
>
> data_y = np.array([0.5,1])
>
> error_x_log = np.array([0.5,1.])
>
> error_x_lower = 10**(data_x_log-error_x_log)
>
> error_x_upper = 10**(data_x_log+error_x_log)
>
> fig = plt.figure()
>
> ax = fig.add_subplot(111)
>
> ax.errorbar(10**data_x_log,data_y,xerr=[error_x_lower,error_x_upper],ls='',marker='o')
>
> ax.set_xscale('log')
>
> ax.set_xlim([1E11,1E17])
>
> ax.set_ylim([0,2])
>
> plt.savefig('error.png')
>
>
> --
> 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
>

 --
 Yuxiang "Shawn" Wang
 Gerling Research Lab
 University of Virginia
 yw...@virginia.edu
 +1 (434) 284-0836
 https://sites.google.com/a/virginia.edu/yw5aj/
>>>
>>
>> --
>> 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
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>
>
> --
> 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


--
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
___
Mat