TextPixelRegion¶
- class regions.TextPixelRegion(center, text, meta=None, visual=None)[source]¶
Bases:
PointPixelRegion
A text string in pixel coordinates.
- Parameters:
- center
PixCoord
The leftmost point of the text string before rotation.
- textstr
The text string.
- meta
RegionMeta
ordict
, optional A dictionary that stores the meta attributes of the region.
- visual
RegionVisual
ordict
, optional A dictionary that stores the visual meta attributes of the region.
- center
Examples
from regions import PixCoord, TextPixelRegion, RegionVisual import matplotlib.pyplot as plt fig, ax = plt.subplots(1, 1) center = PixCoord(x=15, y=10) visual = RegionVisual({'textangle': 30}) reg = TextPixelRegion(center=center, text="Hello World!", visual=visual) reg.plot(ax=ax) ax.set_xlim(10, 30) ax.set_ylim(2.5, 20) ax.set_aspect('equal')
(
Source code
,png
,hires.png
,pdf
,svg
)Attributes Summary
The leftmost pixel position (before rotation) as a
PixCoord
.The meta attributes as a
RegionMeta
The visual attributes as a
RegionVisual
.Methods Summary
as_artist
([origin])Return a matplotlib Text object for this region (
matplotlib.text.Text
).to_sky
(wcs)Return a region defined in sky coordinates.
Attributes Documentation
- meta¶
The meta attributes as a
RegionMeta
- visual¶
The visual attributes as a
RegionVisual
.
Methods Documentation
- as_artist(origin=(0, 0), **kwargs)[source]¶
Return a matplotlib Text object for this region (
matplotlib.text.Text
).