A subclass of plate to writing text using grid coordinates. Any **kwargs are passed through to :class:`PGM.Plate`. :param x: The x-coordinate of the text in *model units*. :param y: The y-coordinate of the text. :param label: A string to write. :p
| 1164 | |
| 1165 | |
| 1166 | class Text(Plate): |
| 1167 | """ |
| 1168 | A subclass of plate to writing text using grid coordinates. Any **kwargs |
| 1169 | are passed through to :class:`PGM.Plate`. |
| 1170 | |
| 1171 | :param x: |
| 1172 | The x-coordinate of the text in *model units*. |
| 1173 | |
| 1174 | :param y: |
| 1175 | The y-coordinate of the text. |
| 1176 | |
| 1177 | :param label: |
| 1178 | A string to write. |
| 1179 | |
| 1180 | :param fontsize: (optional) |
| 1181 | The fontsize to use. |
| 1182 | |
| 1183 | """ |
| 1184 | |
| 1185 | def __init__(self, x, y, label, fontsize=None): |
| 1186 | self.rect = [x, y, 0.0, 0.0] |
| 1187 | self.label = label |
| 1188 | self.fontsize = fontsize |
| 1189 | self.label_offset = [0.0, 0.0] |
| 1190 | self.bbox = {"fc": "none", "ec": "none"} |
| 1191 | self.rect_params = {"ec": "none"} |
| 1192 | |
| 1193 | super().__init__( |
| 1194 | rect=self.rect, |
| 1195 | label=self.label, |
| 1196 | label_offset=self.label_offset, |
| 1197 | fontsize=self.fontsize, |
| 1198 | rect_params=self.rect_params, |
| 1199 | bbox=self.bbox, |
| 1200 | ) |
| 1201 | |
| 1202 | |
| 1203 | class _rendering_context(object): |