Re: [matplotlib-devel] update x axis of a subplot according to the y axis of another one in python/matplotlib

2016-06-10 Thread Alessandro Pietro Bardelli

Hello Benjamin,
last weekend (after more than a year... :-[ ) I found some spare time to 
refactor a bit the solution I implemented to solve the axis synchronisation.
I have answered my own question on stackoverflow 
(http://stackoverflow.com/questions/28239054/update-the-x-axis-of-a-matplotlib-subplot-according-to-the-y-axis-of-a-different/37265661#37265661)
and I have shared on github 
(https://github.com/apbard/OrthogonalProjection) a simple class that 
allows to easily make orthogonal projections plots with full axis 
syncronisation and support for different basic plot types.

Thanks again for the hint and sorry for the delay...

Alessandro

On 12/02/2015 19:58, Alessandro Pietro Bardelli wrote:

thanks for your answer.
I have played a bit with the callbacks and seems very promising.
i'll work on it in the weekend and drop an email as soon as I have 
tested it properly :)

thanks again

Alessandro

On 12/02/2015 15:35, Benjamin Root wrote:
Sharing the same axis across subplots is implemented via matplotlib's 
interactive framework, and is available by default. Glue is built on 
top of matplotlib, extending its interactive framework with many 
additional tools. Yes, it might be overkill for this singular task, 
but implementing orthogonal axis sharing isn't trivial, either, so 
suggesting a pre-packaged solution is merely pragmatic.


Essentially, one would have to register callbacks for changes in each 
of the parent subplot's axis. This, in of itself, isn't really all 
that difficult once one learns the event framework. I think what 
might be very tricky is doing it for the 3d axes. As the de facto 
maintainer of mplot3d, I have never really tested axis sharing for 
mplot3d. I suspect that it would work exactly as you'd expect for the 
x and y axes, but the z axis may prove to be quirky. I don't know, I 
haven't ever tried it out. In general, the z-axis implementation is a 
bit of a kludge, so things tend to be different for it...


Here is an example of how to register callbacks to changes in a 
particular axis. Hopefully, it can give you a nice leg up on the 
problem. Let me know if you have problems with the z-axis, I might be 
able to help sort it out. If you can get this to work, I would 
certainly love to include it in the gallery.

http://matplotlib.org/examples/event_handling/viewlims.html

Cheers!
Ben Root


On Thu, Feb 12, 2015 at 4:32 AM, Alessandro Pietro Bardelli 
 wrote:


Thanks for the answer.
Glue seems a quite cool project but it is also a bit overkill for
this specific task, isn't it?
Basically I just would like tell sharex to point the Yaxis of the
axes object.
Isn't there a way to do this within matplotlib?
thanks

Alessandro

On 11/02/2015 16:41, Benjamin Root wrote:

Sounds to me like you want to use glue:
http://www.glueviz.org/en/stable/


On Wed, Feb 11, 2015 at 3:15 AM, Alessandro Pietro Bardelli
> wrote:

I would like to plot an orthogonal projection (like this one
http://i.stack.imgur.com/DnNds.jpg) using matplotlib
possibly including also the 3D subplot. All the pictures
should share common axes.

|fig =plt.figure()ax =fig.add_subplot(221,title="XZ")bx
=fig.add_subplot(222,title="YZ",sharey=ax)cx
=fig.add_subplot(223,title="XY",sharex=ax,sharey=[something
like bx.Xaxis])dx

=fig.add_subplot(224,title="XYZ",projection="3d",sharex=ax,sharey=bx,sharez=[something
like bx.Yaxis]|

The problem is that I have to "link" on X axis of a plot
with the Y one of another and
Is there a way to accomplish this?

Thanks

Alessandro

p.s. i have posted this question also on StackOverflow:

http://stackoverflow.com/questions/28239054/update-x-axis-of-a-subplot-according-to-the-y-axis-of-another-one-in-python-matp



--
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-devel mailing list
Matplotlib-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-devel




-- 


--
Alessandro Pietro Bardelli

HENESIS s.r.l.
P.IVA (VAT. N.) IT02280660354
Viale dei Mille, 108
43125 PARMA (IT)

Email: 

Re: [matplotlib-devel] update x axis of a subplot according to the y axis of another one in python/matplotlib

2015-02-12 Thread Alessandro Pietro Bardelli

Thanks for the answer.
Glue seems a quite cool project but it is also a bit overkill for this 
specific task, isn't it?
Basically I just would like tell sharex to point the Yaxis of the axes 
object.

Isn't there a way to do this within matplotlib?
thanks

Alessandro

On 11/02/2015 16:41, Benjamin Root wrote:

Sounds to me like you want to use glue: http://www.glueviz.org/en/stable/


On Wed, Feb 11, 2015 at 3:15 AM, Alessandro Pietro Bardelli 
alessandro.barde...@henesis.eu 
mailto:alessandro.barde...@henesis.eu wrote:


I would like to plot an orthogonal projection (like this one
http://i.stack.imgur.com/DnNds.jpg) using matplotlib possibly
including also the 3D subplot. All the pictures should share
common axes.

|fig=  plt.figure()
ax=  fig.add_subplot(221,  title=XZ)
bx=  fig.add_subplot(222,  title=YZ,  sharey=ax)
cx=  fig.add_subplot(223,  title=XY,  sharex=ax,  sharey=[something like 
bx.Xaxis])
dx=  fig.add_subplot(224,  title=XYZ,  projection=3d,  sharex=ax,  
sharey=bx,  sharez=[something like bx.Yaxis]|

The problem is that I have to link on X axis of a plot with the
Y one of another and
Is there a way to accomplish this?

Thanks

Alessandro

p.s. i have posted this question also on StackOverflow:

http://stackoverflow.com/questions/28239054/update-x-axis-of-a-subplot-according-to-the-y-axis-of-another-one-in-python-matp



--
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-devel mailing list
Matplotlib-devel@lists.sourceforge.net
mailto:Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel




--

--
Alessandro Pietro Bardelli

HENESIS s.r.l.
P.IVA (VAT. N.) IT02280660354
Viale dei Mille, 108
43125 PARMA (IT)

Email: alessandro.barde...@henesis.eu

Tel: (+39)05211854211
Fax: (+39)05211854515
SkypeID: henesis_srl
Web: www.henesis.eu
--
--
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-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] update x axis of a subplot according to the y axis of another one in python/matplotlib

2015-02-12 Thread Benjamin Root
Sharing the same axis across subplots is implemented via matplotlib's
interactive framework, and is available by default. Glue is built on top of
matplotlib, extending its interactive framework with many additional tools.
Yes, it might be overkill for this singular task, but implementing
orthogonal axis sharing isn't trivial, either, so suggesting a pre-packaged
solution is merely pragmatic.

Essentially, one would have to register callbacks for changes in each of
the parent subplot's axis. This, in of itself, isn't really all that
difficult once one learns the event framework. I think what might be very
tricky is doing it for the 3d axes. As the de facto maintainer of mplot3d,
I have never really tested axis sharing for mplot3d. I suspect that it
would work exactly as you'd expect for the x and y axes, but the z axis may
prove to be quirky. I don't know, I haven't ever tried it out. In general,
the z-axis implementation is a bit of a kludge, so things tend to be
different for it...

Here is an example of how to register callbacks to changes in a particular
axis. Hopefully, it can give you a nice leg up on the problem. Let me know
if you have problems with the z-axis, I might be able to help sort it out.
If you can get this to work, I would certainly love to include it in the
gallery.
http://matplotlib.org/examples/event_handling/viewlims.html

Cheers!
Ben Root


On Thu, Feb 12, 2015 at 4:32 AM, Alessandro Pietro Bardelli 
alessandro.barde...@henesis.eu wrote:

  Thanks for the answer.
 Glue seems a quite cool project but it is also a bit overkill for this
 specific task, isn't it?
 Basically I just would like tell sharex to point the Yaxis of the axes
 object.
 Isn't there a way to do this within matplotlib?
 thanks

 Alessandro

 On 11/02/2015 16:41, Benjamin Root wrote:

 Sounds to me like you want to use glue: http://www.glueviz.org/en/stable/


 On Wed, Feb 11, 2015 at 3:15 AM, Alessandro Pietro Bardelli 
 alessandro.barde...@henesis.eu wrote:

  I would like to plot an orthogonal projection (like this one
 http://i.stack.imgur.com/DnNds.jpg) using matplotlib possibly including
 also the 3D subplot. All the pictures should share common axes.

 fig = plt.figure()
 ax = fig.add_subplot(221, title=XZ)
 bx = fig.add_subplot(222, title=YZ, sharey=ax)
 cx = fig.add_subplot(223, title=XY, sharex=ax, sharey=[something like 
 bx.Xaxis])
 dx = fig.add_subplot(224, title=XYZ, projection=3d, sharex=ax, 
 sharey=bx, sharez=[something like bx.Yaxis]

 The problem is that I have to link on X axis of a plot with the Y one
 of another and
 Is there a way to accomplish this?

 Thanks

 Alessandro

 p.s. i have posted this question also on StackOverflow:
 http://stackoverflow.com/questions/28239054/update-x-axis-of-a-subplot-according-to-the-y-axis-of-another-one-in-python-matp


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



 --

 --
 Alessandro Pietro Bardelli

 HENESIS s.r.l.
 P.IVA (VAT. N.) IT02280660354
 Viale dei Mille, 108
 43125 PARMA (IT)

 Email: alessandro.barde...@henesis.eu

 Tel: (+39)05211854211
 Fax: (+39)05211854515
 SkypeID: henesis_srl
 Web: www.henesis.eu
 --

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


Re: [matplotlib-devel] update x axis of a subplot according to the y axis of another one in python/matplotlib

2015-02-11 Thread Benjamin Root
Sounds to me like you want to use glue: http://www.glueviz.org/en/stable/


On Wed, Feb 11, 2015 at 3:15 AM, Alessandro Pietro Bardelli 
alessandro.barde...@henesis.eu wrote:

  I would like to plot an orthogonal projection (like this one
 http://i.stack.imgur.com/DnNds.jpg) using matplotlib possibly including
 also the 3D subplot. All the pictures should share common axes.

 fig = plt.figure()
 ax = fig.add_subplot(221, title=XZ)
 bx = fig.add_subplot(222, title=YZ, sharey=ax)
 cx = fig.add_subplot(223, title=XY, sharex=ax, sharey=[something like 
 bx.Xaxis])
 dx = fig.add_subplot(224, title=XYZ, projection=3d, sharex=ax, sharey=bx, 
 sharez=[something like bx.Yaxis]

 The problem is that I have to link on X axis of a plot with the Y one of
 another and
 Is there a way to accomplish this?

 Thanks

 Alessandro

 p.s. i have posted this question also on StackOverflow:
 http://stackoverflow.com/questions/28239054/update-x-axis-of-a-subplot-according-to-the-y-axis-of-another-one-in-python-matp


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


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