Pixel Position of X/Y Axis

MPL Users,

How can I get the matched max and min pixel/coordinate positions of my
x and y axises?

Thanks,

LarsenMTL

I am not sure what you are asking – could you elaborate?

JDH

···

On Thu, Apr 16, 2009 at 1:10 PM, Mark Larsen <larsenmtl@…287…> wrote:

MPL Users,

How can I get the matched max and min pixel/coordinate positions of my

x and y axises?

I am not sure what you are asking -- could you elaborate?

Sorry. I use matplotlib to create PNGs graphics for display on a
web-page. I want to make the plots zoom-able. I'll use javascript to
capture the pixel positions of the user's selected zoom region on the
PNG plot. I'll then translate this into the coordinate system on the
plot and redraw it with a new x, y range. I'm having trouble
translating the initial axises into the pixel positions (essentially
where they are on the PNG image).

For example, I use the following code to map point positions from the
coordinate system to pixel positions. I use an img map <MAP> to
provide interaction with the actual lines.

[CODE]

lineObj = plt.plot(Xs,Ys,marker='o')[0]
path, affine = lineObj._transformed_path.get_transformed_points_and_affine()
path = affine.transform_path(path)
for real,pixel in zip(lineObj.get_xydata(),path.vertices):
## write <AREA> tag for each point

[/CODE]

I'd like to get information similar to this for the axis of the plot.

Thanks.

It's been a while, please allow me to bump this...

···

Sorry. I use matplotlib to create PNGs graphics for display on a
web-page. I want to make the plots zoom-able. I'll use javascript to
capture the pixel positions of the user's selected zoom region on the
PNG plot. I'll then translate this into the coordinate system on the
plot and redraw it with a new x, y range. I'm having trouble
translating the initial axises into the pixel positions (essentially
where they are on the PNG image).

For example, I use the following code to map point positions from the
coordinate system to pixel positions. I use an img map <MAP> to
provide interaction with the actual lines.

[CODE]

lineObj = plt.plot(Xs,Ys,marker='o')[0]
path, affine = lineObj._transformed_path.get_transformed_points_and_affine()
path = affine.transform_path(path)
for real,pixel in zip(lineObj.get_xydata(),path.vertices):
## write <AREA> tag for each point

[/CODE]

I'd like to get information similar to this for the axis of the plot.

Thanks.

You may use the bbox attribute of the axes.
For example, ax.bbox.extents gives you the x,y coordinates of the
lowerleft and topright corners.

-JJ

···

On Wed, Apr 29, 2009 at 4:06 PM, Mark Larsen <larsenmtl@...287...> wrote:

It's been a while, please allow me to bump this...

Sorry. I use matplotlib to create PNGs graphics for display on a
web-page. I want to make the plots zoom-able. I'll use javascript to
capture the pixel positions of the user's selected zoom region on the
PNG plot. I'll then translate this into the coordinate system on the
plot and redraw it with a new x, y range. I'm having trouble
translating the initial axises into the pixel positions (essentially
where they are on the PNG image).

For example, I use the following code to map point positions from the
coordinate system to pixel positions. I use an img map <MAP> to
provide interaction with the actual lines.

[CODE]

lineObj = plt.plot(Xs,Ys,marker='o')[0]
path, affine = lineObj._transformed_path.get_transformed_points_and_affine()
path = affine.transform_path(path)
for real,pixel in zip(lineObj.get_xydata(),path.vertices):
## write <AREA> tag for each point

[/CODE]

I'd like to get information similar to this for the axis of the plot.

Thanks.

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

You may use the bbox attribute of the axes.
For example, ax.bbox.extents gives you the x,y coordinates of the
lowerleft and topright corners.

Perfect, thanks so much.