|
13 | 13 | "raw_mimetype": "text/restructuredtext" |
14 | 14 | }, |
15 | 15 | "source": [ |
16 | | - "ProPlot registers several new color names and font families. These are described below." |
| 16 | + "ProPlot registers several new color names and font families, and includes tools for defining your own color names and adding your own font families. These features are described below." |
17 | 17 | ] |
18 | 18 | }, |
19 | 19 | { |
20 | 20 | "cell_type": "markdown", |
21 | 21 | "metadata": {}, |
22 | 22 | "source": [ |
23 | | - "## Included color names" |
| 23 | + "## Included colors" |
24 | 24 | ] |
25 | 25 | }, |
26 | 26 | { |
|
48 | 48 | "cell_type": "markdown", |
49 | 49 | "metadata": {}, |
50 | 50 | "source": [ |
51 | | - "## Drawing from cmaps and cycles" |
| 51 | + "## Colors from colormaps" |
52 | 52 | ] |
53 | 53 | }, |
54 | 54 | { |
|
57 | 57 | "raw_mimetype": "text/restructuredtext" |
58 | 58 | }, |
59 | 59 | "source": [ |
60 | | - "If you want to draw an individual color from a smooth colormap or a color cycle, use ``color=(cmap, coord)`` or ``color=(cycle, index)`` with any command that accepts the `color` keyword. The ``coord`` should be between ``0`` and ``1``, while the ``index`` is the index on the list of cycle colors. This feature is powered by the `~proplot.styletools.ColorDict` class. This is useful if you spot a nice color in one of the available colormaps and want to use it for some arbitrary plot element." |
| 60 | + "If you want to draw an individual color from a colormap or a color cycle, use ``color=(cmap, coord)`` or ``color=(cycle, index)`` with any command that accepts the `color` keyword. The ``coord`` should be between ``0`` and ``1``, while the ``index`` is the index on the list of cycle colors. This feature is powered by the `~proplot.styletools.ColorDict` class. This is useful if you spot a nice color in one of the available colormaps and want to use it for some arbitrary plot element." |
61 | 61 | ] |
62 | 62 | }, |
63 | 63 | { |
|
97 | 97 | "cell_type": "markdown", |
98 | 98 | "metadata": {}, |
99 | 99 | "source": [ |
100 | | - "## Included font names" |
| 100 | + "## Using your own colors" |
101 | 101 | ] |
102 | 102 | }, |
103 | 103 | { |
|
106 | 106 | "raw_mimetype": "text/restructuredtext" |
107 | 107 | }, |
108 | 108 | "source": [ |
109 | | - "ProPlot adds several open source sans-serif fonts, introduces a `~proplot.styletools.show_fonts` command to display the available sans-serif fonts on your system, and tries to make the default font *Helvetica Neue*, *Helvetica*, or *Arial* if they are installed. Generally speaking, simple, clean sans-serif fonts are more appropriate for figures than serif fonts.\n", |
| 109 | + "You can register your own colors by adding ``.txt`` files to the ``~/.proplot/colors`` directory and calling `~proplot.styletools.register_colors`. This command is also called on import. Each file should contain lines that look like ``color: #xxyyzz`` where ``color`` is the registered color name and ``#xxyyzz`` is the HEX color value." |
| 110 | + ] |
| 111 | + }, |
| 112 | + { |
| 113 | + "cell_type": "markdown", |
| 114 | + "metadata": {}, |
| 115 | + "source": [ |
| 116 | + "## Included fonts" |
| 117 | + ] |
| 118 | + }, |
| 119 | + { |
| 120 | + "cell_type": "raw", |
| 121 | + "metadata": { |
| 122 | + "raw_mimetype": "text/restructuredtext" |
| 123 | + }, |
| 124 | + "source": [ |
| 125 | + "ProPlot adds several open source sans-serif fonts and introduces a `~proplot.styletools.show_fonts` command to display the available sans-serif fonts on your system (see `~matplotlib.font_manager`). Generally speaking, simple, clean sans-serif fonts are more appropriate for figures than serif fonts.\n", |
110 | 126 | "\n", |
111 | | - "You can register your own fonts by adding ``.ttf`` and ``.otf`` files to the ``~/.proplot/fonts`` directory and calling `~proplot.styletools.register_fonts` (which is also called on import). To change the default font, use the `~proplot.rctools.rc` object or modify your ``~/.proplotrc``. See :ref:`Configuring proplot` for details." |
| 127 | + "ProPlot also changes the default font to the Helvetica-lookalike TeX Gyre Heros. Matplotlib uses DejaVu Sans by default because DejaVu Sans is open source, can be *included* in the matplotlib distribution, and includes glyphs for a wider range of mathematical characters (where you see the \"¤\" dummy symbol in the below table, that character is unavailable). However Helvetica and Arial are much more mature and (in this developer's humble opinion) aesthetically pleasing. Thus, while ProPlot prioritizes aesthetics, you may need to switch to a font with more math characters like DejaVu Sans or Fira Math." |
112 | 128 | ] |
113 | 129 | }, |
114 | 130 | { |
|
118 | 134 | "outputs": [], |
119 | 135 | "source": [ |
120 | 136 | "import proplot as plot\n", |
121 | | - "f = plot.show_fonts()" |
| 137 | + "f = plot.show_fonts('DejaVu Sans', 'Fira Math', 'Helvetica', 'TeX Gyre Heros')" |
| 138 | + ] |
| 139 | + }, |
| 140 | + { |
| 141 | + "cell_type": "markdown", |
| 142 | + "metadata": {}, |
| 143 | + "source": [ |
| 144 | + "## Using your own fonts" |
| 145 | + ] |
| 146 | + }, |
| 147 | + { |
| 148 | + "cell_type": "raw", |
| 149 | + "metadata": { |
| 150 | + "raw_mimetype": "text/restructuredtext" |
| 151 | + }, |
| 152 | + "source": [ |
| 153 | + "You can register your own fonts by adding files to the ``~/.proplot/fonts`` directory and calling `~proplot.styletools.register_fonts`. This command is also called on import. To change the default font, use the `~proplot.rctools.rc` object or modify your ``~/.proplotrc``.See :ref:`Configuring proplot` for details.\n", |
| 154 | + "\n", |
| 155 | + "Sometimes the font you would like to use *is* installed, but the font file is not stored under the matplotlib-compatible ``.ttf``, ``.otf``, or ``.afm`` formats. For example, several macOS fonts are unavailable because they are stored as ``.dfont`` collections. Also, while matplotlib nominally supports ``.ttc`` collections, ProPlot manually removes them because figures with ``.ttc`` fonts `cannot be saved as PDFs <https://github.com/matplotlib/matplotlib/issues/3135>`__. You can get matplotlib to use these fonts by expanding the \"collections\" into individual ``.ttf`` files with the `DFontSplitter application <https://peter.upfold.org.uk/projects/dfontsplitter>`__, then saving the files in-place or in the ``~/.proplot/fonts`` folder.\n", |
| 156 | + "\n", |
| 157 | + "To find font files, check the paths listed in ``OSXFontDirectories``, ``X11FontDirectories``, ``MSUserFontDirectories``, and ``MSFontDirectories`` under the `~matplotlib.font_manager` module. Note that if the font in question has a \"thin\" style, implied by file names with the word ``Thin``, `a matplotlib bug <https://github.com/matplotlib/matplotlib/issues/8788>`__ may cause these styles to override the \"normal\" style!" |
122 | 158 | ] |
123 | 159 | } |
124 | 160 | ], |
|
0 commit comments