Hi Eric, All,

On 21 September 2012 15:46, Moore, Eric (NIH/NIDDK) [F] wrote:
>> -----Original Message-----
>> From: Andrea Gavana [mailto:andrea.gav...@gmail.com]
>> Sent: Wednesday, September 19, 2012 11:09 AM
>> To: matplotlib-users@lists.sourceforge.net
>> Subject: [Matplotlib-users] Image as marker and axes "equal" aspect
>> ratio
>>
>> Hi All,
>>
>>     I am currently trying to plot 4 points (but they will be more, in
>> an animated sequence later), and I am trying to use an image as a point
>> marker. I am using the axes transData transform to get the point
>> coordinates from the data world to the display world.
>>
>> Everything seems to be working OK (i.e., the images are placed
>> correctly close to the plot points); however, as soon as I try to force
>> the axes into an "equal" aspect ratio with this command:
>>
>> ax.set_aspect('equal')
>>
>> Then all the calculations are messed up and the images end up very far
>> from the plot points. I have tried also the approach mentioned in this
>> StackOverflow post:
>>
>> http://stackoverflow.com/questions/2318288/how-to-use-custom-marker-
>> with-plot
>>
>> But I get the same wrong answer when I set the "equal" aspect ratio for
>> the axes.
>>
>> I am attaching a small sample application which demonstrates the
>> problem, a small  "smiley.png" image needed to run the script and two
>> plots generated by my script, one with the "equal" aspect ratio and the
>> other without.
>>
>> I appreciate any suggestion, as I feel I am missing something
>> important...
>>
> The source of the problem is that the transformation you are using has not 
> been updated to account for your set_aspect call.  I played around a little 
> bit, but I'm not sure how to force mpl to update the transform.  Perhaps 
> someone else can comment.  This is a very fragile way to do things anyway 
> because figimage places the image in screen coordinates and you really would 
> like to place it relative to the axis.

Thank you for your answer and for taking the time to play with the
sample I posted. I know that using figimage is not exactly the best
way to go, but I can only think of two other approaches:

1) Use imshow: from the documentation, it appears to me that you can't
place an image wherever you want, and I was unable to find any example
on how to use imshow to place multiple images in a specific place
inside the axes;

2) Use scatter: again, from the docs it seems that scatter supports
symbols, mathtext, paths and regular polygons, but no images...

I may of course be wrong about the above statements, and again I
welcome any suggestion you may have.

Thank you.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to