Hi Derek,

What are we looking at here?

The following code:

import matplotlib.pyplot as plt
import matplotlib.transforms as mtrans
import numpy as np

plt.figure()
ax = plt.subplot(111)
base_trans = ax.transData
mtx = np.array([[1,1,0],
                [0,1,0],
                [0,0,1]])
tr = mtrans.Affine2D(matrix=mtx) + base_trans

plt.plot([1,2,3], [1,2,3], 'gray', transform=tr)
plt.scatter([1,2,3], [1,2,3], c='k', marker='D', transform=tr)
plt.show()

produces the following plot on v1.2.0:
[image: Inline images 1]
Is this unexpected or are you getting a different result to me?

Regards,



On 4 April 2013 17:06, Derek Thomas <derekctho...@gmail.com> wrote:

> I posted a related question on stackoverflow
> (
> http://stackoverflow.com/questions/15815862/apply-affine-transform-to-quiver-in-python-matplotlib
> )
> but I've produced a simple enough example with strange results that I
> think it merits attention here.  I'm trying to apply affine transforms
> to quiver and scatter plots.  In all cases that I've considered, the
> scatter and quiver plots transform opposite the regular plot.  Here's
> a minimal case:
>
> import matplotlib as mpl
> from pylab import figure, subplot, plot, scatter, show, axis
>
> figure()
> ax = subplot(111)
> base_trans = ax.transData
> tr =  mpl.transforms.Affine2D(matrix =
> array([[1,1,0],[0,1,0],[0,0,1]])) + base_trans
>
>
> plot( [1,2,3], [1,2,3], 'k.', transform = tr )
> scatter( [1,2,3], [1,2,3], c = 'k', marker = 'D', transform = tr )
> axis([0,7,0,7])
> show()
>
> Thanks,
>
> Derek
>
>
> ------------------------------------------------------------------------------
> Minimize network downtime and maximize team effectiveness.
> Reduce network management and security costs.Learn how to hire
> the most talented Cisco Certified professionals. Visit the
> Employer Resources Portal
> http://www.cisco.com/web/learning/employer_resources/index.html
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

<<figure_1.png>>

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to