This is off the top of my head. I haven't really been following this 
thread and I wasn't able to determine which was the most current patch 
to apply.

It looks like you don't actually want to apply the axes transform twice 
(which get_xaxis_transform() + mtransforms.ScaledTranslation(0.5, 0, 
self.axes.transAxes) would do). 

What seems to work for me is to transform the input coordinates *before* 
applying the existing axis transform:

    mtransforms.Affine2D().translate(0.0, 0.5) + self.get_xaxis_transform()

I would suggest that you could keep two kinds of spine transforms (those 
relative to the axes and those given in points) separate.  Build the 
whole pipeline all the time and then just allow the user to tweak either 
or both, and thus have something like:

    transform_by_axes_units + self.get_xaxis_transform() + 
transform_by_points

Using them in combination may be rare, but isn't completely nonsensical.

Hope that helps,
Mike

Andrew Straw wrote:
> Hi MPL transform gurus (aka Mike),
>
> I'm trying to close on this "dropped spine" thing, and I have a question
> I think you could save me some time on.
>
> I need to get a transform that will be combined with the normal xaxis
> transform to shift the spine and associated ticks and tick labels by
> some amount. For my first incarnation, I used something like
>
> mtransforms.ScaledTranslation(offset_x,offset_y,self.figure.dpi_scale_trans)
>
> This is fine when I new the offset in points directly. However, now I'd
> like to support offsetting the spine to the center of the Axes. So, for
> this case, I'd like to calculate the offset transform required to take
> axes coordinate 0 and translate it to 0.5. Thus, I think I need
> something like
>
> mtransforms.ScaledTranslation(0.5, 0, self.axes.transAxes)
>
> Unfortunately, that's clearly not working. So, is there a quick fix for
> this?
>
> Note that, as I've implemented things, the easiest path is that the new
> transform is a translation combined with the existing xaxis transform
> (using "get_xaxis_transform() + my_new_transform"). Other methods may be
> possible, but I think they'll be a lot more work.
>
> Thanks,
> Andrew
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to