| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a9ba9d5 commit 9b8a598
12 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -147,7 +147,6 @@ Alphabetical list of modules: | |||
| 147 | 147 | testing_api.rst | |
| 148 | 148 | text_api.rst | |
| 149 | 149 | texmanager_api.rst | |
| 150 | - textpath_api.rst | ||
| 151 | 150 | ticker_api.rst | |
| 152 | 151 | tight_bbox_api.rst | |
| 153 | 152 | tight_layout_api.rst | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,8 @@ | |||
| 2 | 2 | ``matplotlib.text`` | |
| 3 | 3 | ******************* | |
| 4 | 4 | ||
| 5 | + .. redirect-from:: /api/textpath_api | ||
| 6 | + | ||
| 5 | 7 | .. automodule:: matplotlib.text | |
| 6 | 8 | :no-members: | |
| 7 | 9 | ||
@@ -19,3 +21,13 @@ | |||
| 19 | 21 | :members: | |
| 20 | 22 | :undoc-members: | |
| 21 | 23 | :show-inheritance: | |
| 24 | + | ||
| 25 | + .. autoclass:: matplotlib.text.TextPath | ||
| 26 | + :members: | ||
| 27 | + :undoc-members: | ||
| 28 | + :show-inheritance: | ||
| 29 | + | ||
| 30 | + .. autoclass:: matplotlib.text.TextToPath | ||
| 31 | + :members: | ||
| 32 | + :undoc-members: | ||
| 33 | + :show-inheritance: | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ | |||
| 13 | 13 | import matplotlib.pyplot as plt | |
| 14 | 14 | from matplotlib.markers import MarkerStyle | |
| 15 | 15 | from matplotlib.transforms import Affine2D | |
| 16 | - from matplotlib.textpath import TextPath | ||
| 16 | + from matplotlib.text import TextPath | ||
| 17 | 17 | from matplotlib.colors import Normalize | |
| 18 | 18 | ||
| 19 | 19 | SUCCESS_SYMBOLS = [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ | |||
| 11 | 11 | import matplotlib.cm as cm | |
| 12 | 12 | import matplotlib.font_manager | |
| 13 | 13 | from matplotlib.patches import Rectangle, PathPatch | |
| 14 | - from matplotlib.textpath import TextPath | ||
| 14 | + from matplotlib.text import TextPath | ||
| 15 | 15 | import matplotlib.transforms as mtrans | |
| 16 | 16 | ||
| 17 | 17 | MPL_BLUE = '#11557c' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | Using a text as a Path | |
| 4 | 4 | ====================== | |
| 5 | 5 | ||
| 6 | - `~matplotlib.textpath.TextPath` creates a `.Path` that is the outline of the | ||
| 6 | + `~matplotlib.text.TextPath` creates a `.Path` that is the outline of the | ||
| 7 | 7 | characters of a text. The resulting path can be employed e.g. as a clip path | |
| 8 | 8 | for an image. | |
| 9 | 9 | """ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,7 +43,7 @@ | |||
| 43 | 43 | ||
| 44 | 44 | import matplotlib as mpl | |
| 45 | 45 | from matplotlib import ( | |
| 46 | - _api, backend_tools as tools, cbook, colors, _docstring, textpath, | ||
| 46 | + _api, backend_tools as tools, cbook, colors, _docstring, text, | ||
| 47 | 47 | _tight_bbox, transforms, widgets, get_backend, is_interactive, rcParams) | |
| 48 | 48 | from matplotlib._pylab_helpers import Gcf | |
| 49 | 49 | from matplotlib.backend_managers import ToolManager | |
@@ -172,7 +172,7 @@ class RendererBase: | |||
| 172 | 172 | def __init__(self): | |
| 173 | 173 | super().__init__() | |
| 174 | 174 | self._texmanager = None | |
| 175 | - self._text2path = textpath.TextToPath() | ||
| 175 | + self._text2path = text.TextToPath() | ||
| 176 | 176 | self._raster_depth = 0 | |
| 177 | 177 | self._rasterizing = False | |
| 178 | 178 | ||
@@ -515,7 +515,7 @@ def draw_tex(self, gc, x, y, s, prop, angle, *, mtext=None): | |||
| 515 | 515 | The y location of the text baseline in display coords. | |
| 516 | 516 | s : str | |
| 517 | 517 | The TeX text string. | |
| 518 | - prop : `matplotlib.font_manager.FontProperties` | ||
| 518 | + prop : `~matplotlib.font_manager.FontProperties` | ||
| 519 | 519 | The font properties. | |
| 520 | 520 | angle : float | |
| 521 | 521 | The rotation angle in degrees anti-clockwise. | |
@@ -538,12 +538,12 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None): | |||
| 538 | 538 | The y location of the text baseline in display coords. | |
| 539 | 539 | s : str | |
| 540 | 540 | The text string. | |
| 541 | - prop : `matplotlib.font_manager.FontProperties` | ||
| 541 | + prop : `~matplotlib.font_manager.FontProperties` | ||
| 542 | 542 | The font properties. | |
| 543 | 543 | angle : float | |
| 544 | 544 | The rotation angle in degrees anti-clockwise. | |
| 545 | 545 | ismath : bool or "TeX" | |
| 546 | - If True, use mathtext parser. If "TeX", use *usetex* mode. | ||
| 546 | + If True, use mathtext parser. If "TeX", use tex for rendering. | ||
| 547 | 547 | mtext : `matplotlib.text.Text` | |
| 548 | 548 | The original text object to be rendered. | |
| 549 | 549 | ||
@@ -569,12 +569,18 @@ def _get_text_path_transform(self, x, y, s, prop, angle, ismath): | |||
| 569 | 569 | ||
| 570 | 570 | Parameters | |
| 571 | 571 | ---------- | |
| 572 | - prop : `matplotlib.font_manager.FontProperties` | ||
| 573 | - The font property. | ||
| 572 | + x : float | ||
| 573 | + The x location of the text in display coords. | ||
| 574 | + y : float | ||
| 575 | + The y location of the text baseline in display coords. | ||
| 574 | 576 | s : str | |
| 575 | 577 | The text to be converted. | |
| 578 | + prop : `~matplotlib.font_manager.FontProperties` | ||
| 579 | + The font property. | ||
| 580 | + angle : float | ||
| 581 | + Angle in degrees to render the text at. | ||
| 576 | 582 | ismath : bool or "TeX" | |
| 577 | - If True, use mathtext parser. If "TeX", use *usetex* mode. | ||
| 583 | + If True, use mathtext parser. If "TeX", use tex for rendering. | ||
| 578 | 584 | """ | |
| 579 | 585 | ||
| 580 | 586 | text2path = self._text2path | |
@@ -599,18 +605,22 @@ def _get_text_path_transform(self, x, y, s, prop, angle, ismath): | |||
| 599 | 605 | ||
| 600 | 606 | def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath): | |
| 601 | 607 | """ | |
| 602 | - Draw the text by converting them to paths using textpath module. | ||
| 608 | + Draw the text by converting them to paths using `.TextToPath`. | ||
| 603 | 609 | ||
| 604 | 610 | Parameters | |
| 605 | 611 | ---------- | |
| 606 | - prop : `matplotlib.font_manager.FontProperties` | ||
| 607 | - The font property. | ||
| 612 | + x : float | ||
| 613 | + The x location of the text in display coords. | ||
| 614 | + y : float | ||
| 615 | + The y location of the text baseline in display coords. | ||
| 608 | 616 | s : str | |
| 609 | 617 | The text to be converted. | |
| 610 | - usetex : bool | ||
| 611 | - Whether to use usetex mode. | ||
| 618 | + prop : `~matplotlib.font_manager.FontProperties` | ||
| 619 | + The font property. | ||
| 620 | + angle : float | ||
| 621 | + Angle in degrees to render the text at. | ||
| 612 | 622 | ismath : bool or "TeX" | |
| 613 | - If True, use mathtext parser. If "TeX", use *usetex* mode. | ||
| 623 | + If True, use mathtext parser. If "TeX", use tex for rendering. | ||
| 614 | 624 | """ | |
| 615 | 625 | path, transform = self._get_text_path_transform( | |
| 616 | 626 | x, y, s, prop, angle, ismath) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1050,18 +1050,7 @@ def _adjust_char_id(self, char_id): | |||
| 1050 | 1050 | return char_id.replace("%20", "_") | |
| 1051 | 1051 | ||
| 1052 | 1052 | def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext=None): | |
| 1053 | - """ | ||
| 1054 | - Draw the text by converting them to paths using the textpath module. | ||
| 1055 | - | ||
| 1056 | - Parameters | ||
| 1057 | - ---------- | ||
| 1058 | - s : str | ||
| 1059 | - text to be converted | ||
| 1060 | - prop : `matplotlib.font_manager.FontProperties` | ||
| 1061 | - font property | ||
| 1062 | - ismath : bool | ||
| 1063 | - If True, use mathtext parser. If "TeX", use *usetex* mode. | ||
| 1064 | - """ | ||
| 1053 | + # docstring inherited | ||
| 1065 | 1054 | writer = self.writer | |
| 1066 | 1055 | ||
| 1067 | 1056 | writer.comment(s) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -516,11 +516,11 @@ def _set_tuple_marker(self): | |||
| 516 | 516 | ||
| 517 | 517 | def _set_mathtext_path(self): | |
| 518 | 518 | """ | |
| 519 | - Draw mathtext markers '$...$' using TextPath object. | ||
| 519 | + Draw mathtext markers '$...$' using `.TextPath` object. | ||
| 520 | 520 | ||
| 521 | 521 | Submitted by tcb | |
| 522 | 522 | """ | |
| 523 | - from matplotlib.textpath import TextPath | ||
| 523 | + from matplotlib.text import TextPath | ||
| 524 | 524 | ||
| 525 | 525 | # again, the properties could be initialised just once outside | |
| 526 | 526 | # this function | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ | |||
| 15 | 15 | from .artist import Artist | |
| 16 | 16 | from .font_manager import FontProperties | |
| 17 | 17 | from .patches import FancyArrowPatch, FancyBboxPatch, Rectangle | |
| 18 | - from .textpath import TextPath # noqa # Unused, but imported by others. | ||
| 18 | + from .textpath import TextPath, TextToPath # noqa # Logically located here | ||
| 19 | 19 | from .transforms import ( | |
| 20 | 20 | Affine2D, Bbox, BboxBase, BboxTransformTo, IdentityTransform, Transform) | |
| 21 | 21 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments