I want to draw some labels with plot.text() and have them appear a
given number of pixels (or mm, or points) to above and to the right of
the data points they are describing. Is there some way to specify a
screen offset from a point in graph coordinates? Like a method of the
axes that converts from screen to graph coords? Using graph
coordinates means that when I zoom in really close to see some
details, the text labels are way out in never-never land.
Thanks,
--bb
Bill,
You can see an example of how to do something similar by looking at the QuiverKey class in quiver.py. It is all a matter of using the transforms module.
Eric
Bill Baxter wrote:
···
I want to draw some labels with plot.text() and have them appear a
given number of pixels (or mm, or points) to above and to the right of
the data points they are describing. Is there some way to specify a
screen offset from a point in graph coordinates? Like a method of the
axes that converts from screen to graph coords? Using graph
coordinates means that when I zoom in really close to see some
details, the text labels are way out in never-never land.
Thanks,
--bb
Great. Thanks. I'll take a look at that file. Is "transFigure" the
one that I was calling "screen space"?
--bb
···
On 7/28/06, Eric Firing <efiring@...202...> wrote:
Bill,
You can see an example of how to do something similar by looking at the
QuiverKey class in quiver.py. It is all a matter of using the
transforms module.
Eric
Bill Baxter wrote:
> I want to draw some labels with plot.text() and have them appear a
> given number of pixels (or mm, or points) to above and to the right of
> the data points they are describing. Is there some way to specify a
> screen offset from a point in graph coordinates? Like a method of the
> axes that converts from screen to graph coords? Using graph
> coordinates means that when I zoom in really close to see some
> details, the text labels are way out in never-never land.
>
> Thanks,
> --bb
Bill Baxter wrote:
Great. Thanks. I'll take a look at that file. Is "transFigure" the
one that I was calling "screen space"?
All of the transforms go from some particular coordinate system to what one might call "screen coordinates": position in dots (pixels), with (0,0) in the lower left corner. transFigure and transAxes go from normalized coordinates to these screen coordinates; for transFigure, (0,0) and (1,1) are the lower left and upper right corners of the figure, and for transAxes they are the corners of the axes.
I think that what you want to do requires something like the mechanism in QuiverKey: a derived artist with a draw method that figures out at draw time where to put the text; I don't think there is any other way to handle zooming while keeping the screen separation from a data point fixed.
This may be a common enough task to warrant adding an "offset" tuple kwarg to the Text class, and maybe a transOffset as well.
Eric
···
--bb
On 7/28/06, Eric Firing <efiring@...202...> wrote:
Bill,
You can see an example of how to do something similar by looking at the
QuiverKey class in quiver.py. It is all a matter of using the
transforms module.
Eric
Bill Baxter wrote:
> I want to draw some labels with plot.text() and have them appear a
> given number of pixels (or mm, or points) to above and to the right of
> the data points they are describing. Is there some way to specify a
> screen offset from a point in graph coordinates? Like a method of the
> axes that converts from screen to graph coords? Using graph
> coordinates means that when I zoom in really close to see some
> details, the text labels are way out in never-never land.
>
> Thanks,
> --bb