Hi,
I was going to try to start working on a TextCollection class (finally!), and I thought it might be good to discuss some of it here before I get too far along.
Motivations:
*Speed up and simplify drawing of multiple text objects with common properties
by reusing a single graphics context while drawing
*Useful for doing plots using the text representation of values (think of a
scatter plot with numbers instead of markers). This is my particular
use case.
*Useful for handling tick labels
Current thoughts:
- TextCollection will draw multiple strings (at multiple locations) with a
common FontProperties(), rotation, linespacing, and alignment.
- TextCollection will inherit from Text so that all of the getting/setting of these common properties is gotten "for free". What about all of the new
Fancy bbox support of text? Do we handle this in text collection as well?
- Should TextCollection also inherit from ScalarMappable so that we can colormap
text values? On one hand this sounds nice and would be similar to the
other collections. On the other, I can see this making for a difficult
to understand plot. My feeling is that if there's no technical reason
not to add a feature, give the user the power (to shoot themselves in the
foot).
- Create a new Axes method `text_plot()` (anyone got a better name?) that works
like scatter, based on TextCollection. Takes x,y, and data values, as
well as optional colormapping array. Also takes a string or function
that controls formatting of text as well as (optional) x0,y0 scalar
offsets (in points/pixels) that control where the text is placed in
relation to the x,y location. These offsets would, for instance, allow
one to plot city names above the dot marking the location instead of on
top of it.
Any thoughts? I'm especially interested in any potential pitfalls (like inheriting from Text).
Ryan
···
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma