offset_copy()

Hi,

I noticed that offset_copy() went away in the transforms rewrite and was replaced with a trans + transfroms.Affine2D().translate(x,y). This works fine for x,y in pixels. However, offset_copy would also let you specify x,y in points. How can I get that to work with the new transforms? More importantly, can I do it without knowing the dpi?

Ryan

···

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

You should be able to get the dpi -- at least if you are working with
an Artist instance, you can access the dpi as a.figure.dpi. With
this, you can scale the x and y of the translation to do offsets in
dpi.

JDH

···

On Sun, Jul 20, 2008 at 3:44 PM, Ryan May <rmay31@...149...> wrote:

I noticed that offset_copy() went away in the transforms rewrite and was
replaced with a trans + transfroms.Affine2D().translate(x,y). This
works fine for x,y in pixels. However, offset_copy would also let you
specify x,y in points. How can I get that to work with the new
transforms? More importantly, can I do it without knowing the dpi?

Ryan May wrote:

Hi,

I noticed that offset_copy() went away in the transforms rewrite and was
replaced with a trans + transfroms.Affine2D().translate(x,y). This
works fine for x,y in pixels. However, offset_copy would also let you
specify x,y in points. How can I get that to work with the new
transforms? More importantly, can I do it without knowing the dpi?

Also, it looks like examples/pylab_examples/transoffset.py is broken...

(I think more and more we need to automatically run the examples and
compare against "known good" images in svn as a form of automated testing.)

-Andrew

I'll update the example. You may also find ScaledTranlation useful for what you're doing. It will allow you to avoid hardcoding the dpi.

http://matplotlib.sourceforge.net/doc/html/devel/transformations.html#matplotlib.transforms.ScaledTranslation

Cheers,
Mike

Andrew Straw wrote:

···

Ryan May wrote:
  

Hi,

I noticed that offset_copy() went away in the transforms rewrite and was replaced with a trans + transfroms.Affine2D().translate(x,y). This works fine for x,y in pixels. However, offset_copy would also let you specify x,y in points. How can I get that to work with the new transforms? More importantly, can I do it without knowing the dpi?
    
Also, it looks like examples/pylab_examples/transoffset.py is broken...

(I think more and more we need to automatically run the examples and
compare against "known good" images in svn as a form of automated testing.)

-Andrew

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

The solution is sufficiently obscure, that I decided to just re-introduce offset_copy (r5804). It appears to work as before, and the example works without changes, though let me know if you run into any snags.

Cheers,
Mike

Michael Droettboom wrote:

···

I'll update the example. You may also find ScaledTranlation useful for what you're doing. It will allow you to avoid hardcoding the dpi.

http://matplotlib.sourceforge.net/doc/html/devel/transformations.html#matplotlib.transforms.ScaledTranslation

Cheers,
Mike

Andrew Straw wrote:
  

Ryan May wrote:
  

Hi,

I noticed that offset_copy() went away in the transforms rewrite and was replaced with a trans + transfroms.Affine2D().translate(x,y). This works fine for x,y in pixels. However, offset_copy would also let you specify x,y in points. How can I get that to work with the new transforms? More importantly, can I do it without knowing the dpi?
    

Also, it looks like examples/pylab_examples/transoffset.py is broken...

(I think more and more we need to automatically run the examples and
compare against "known good" images in svn as a form of automated testing.)

-Andrew

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
  
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel