Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 719276c

Browse files
committed
DOC: fix up fonts + incorporate feedback
1 parent e40ca5f commit 719276c

2 files changed

Lines changed: 46 additions & 42 deletions

File tree

doc/users/dflt_style_changes.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ The behavior of the PS and Agg backends was DPI dependent, thus::
444444
mpl.rcParams['hatch.linewidth'] = 1.0 / dpi # previous ps and Agg hatch linewidth
445445

446446

447-
There is no API level control of the hath linewidth.
447+
There is no API level control of the hacth linewidth.
448448

449449

450450
.. _default_changes_font:
@@ -454,12 +454,12 @@ Fonts
454454

455455
The default font has changed from "Bitstream Vera Sans" to "DejaVu
456456
Sans". "DejaVu Sans" is an improvement on "Bistream Vera Sans" that
457-
adds more international, and math characters, but otherwise has the
457+
adds more international and math characters, but otherwise has the
458458
same appearance. Latin, Greek, Cyrillic, Armenian, Georgian, Hebrew,
459459
and Arabic are `all supported
460460
<http://dejavu-fonts.org/wiki/Main_Page>`__ (but right-to-left render
461-
is still not handled by matplotlib). In addition to the practical,
462-
DejaVu contains a sub-set of emoji support
461+
is still not handled by matplotlib). In addition , DejaVu contains a
462+
sub-set of emoji symbols
463463

464464
.. plot::
465465

doc/users/text_props.rst

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@ properties which can be configured via keyword arguments to the text
99
commands (e.g., :func:`~matplotlib.pyplot.title`,
1010
:func:`~matplotlib.pyplot.xlabel` and :func:`~matplotlib.pyplot.text`).
1111

12-
========================== ==============================================================================
12+
========================== ======================================================================================================================
1313
Property Value Type
14-
========================== ==============================================================================
15-
alpha float
16-
backgroundcolor any matplotlib color
17-
bbox rectangle prop dict plus key ``'pad'`` which is a pad in points
14+
========================== ======================================================================================================================
15+
alpha `float`
16+
backgroundcolor any matplotlib :ref:`color <colors>`
17+
bbox `~matplotlib.patches.Rectangle` prop dict plus key ``'pad'`` which is a pad in points
1818
clip_box a matplotlib.transform.Bbox instance
1919
clip_on [True | False]
20-
clip_path a Path instance and a Transform instance, a Patch
21-
color any matplotlib color
20+
clip_path a `~matplotlib.path.Path` instance and a `~matplotlib.transforms.Transform` instance, a `~matplotlib.patches.Patch`
21+
color any matplotlib :ref:`color <colors>`
2222
family [ ``'serif'`` | ``'sans-serif'`` | ``'cursive'`` | ``'fantasy'`` | ``'monospace'`` ]
23-
fontproperties a matplotlib.font_manager.FontProperties instance
23+
fontproperties a `~matplotlib.font_manager.FontProperties` instance
2424
horizontalalignment or ha [ ``'center'`` | ``'right'`` | ``'left'`` ]
2525
label any string
26-
linespacing float
26+
linespacing `float`
2727
multialignment [``'left'`` | ``'right'`` | ``'center'`` ]
2828
name or fontname string e.g., [``'Sans'`` | ``'Courier'`` | ``'Helvetica'`` ...]
2929
picker [None|float|boolean|callable]
30-
position (x,y)
31-
rotation [ angle in degrees ``'vertical'`` | ``'horizontal'``
30+
position (x, y)
31+
rotation [ angle in degrees | ``'vertical'`` | ``'horizontal'`` ]
3232
size or fontsize [ size in points | relative size, e.g., ``'smaller'``, ``'x-large'`` ]
33-
style or fontstyle [ ``'normal'`` | ``'italic'`` | ``'oblique'``]
33+
style or fontstyle [ ``'normal'`` | ``'italic'`` | ``'oblique'`` ]
3434
text string or anything printable with '%s' conversion
35-
transform a matplotlib.transform transformation instance
35+
transform a `~matplotlib.transforms.Transform` instance
3636
variant [ ``'normal'`` | ``'small-caps'`` ]
3737
verticalalignment or va [ ``'center'`` | ``'top'`` | ``'bottom'`` | ``'baseline'`` ]
3838
visible [True | False]
3939
weight or fontweight [ ``'normal'`` | ``'bold'`` | ``'heavy'`` | ``'light'`` | ``'ultrabold'`` | ``'ultralight'``]
40-
x float
41-
y float
40+
x `float`
41+
y `float`
4242
zorder any number
43-
========================== ==============================================================================
43+
========================== ======================================================================================================================
4444

4545

4646
You can layout text with the alignment arguments
@@ -100,40 +100,44 @@ The mapping between the family aliases (``{'cursive', 'fantasy',
100100
is controlled by the following rcParms
101101

102102

103-
+----------------------------+----------------------------------------------------+
104-
| ``'serif'`` | ``'font.serif'`` |
105-
+----------------------------+----------------------------------------------------+
106-
| ``'monospace'`` | ``'font.monospace'`` |
107-
+----------------------------+----------------------------------------------------+
108-
| ``'fantasy'`` | ``'font.fantasy'`` |
109-
+----------------------------+----------------------------------------------------+
110-
|``'cursive'`` | ``'font.cursive'`` |
111-
+----------------------------+----------------------------------------------------+
112-
| ``{'sans', 'sans serif', | ``'font.sans-serif'`` |
113-
| 'sans-serif'}`` | |
114-
| | |
115-
+----------------------------+----------------------------------------------------+
103+
+------------------------------------------+--------------------------------+
104+
| ``'serif'`` | ``'font.serif'`` |
105+
+------------------------------------------+--------------------------------+
106+
| ``'monospace'`` | ``'font.monospace'`` |
107+
+------------------------------------------+--------------------------------+
108+
| ``'fantasy'`` | ``'font.fantasy'`` |
109+
+------------------------------------------+--------------------------------+
110+
| ``'cursive'`` | ``'font.cursive'`` |
111+
+------------------------------------------+--------------------------------+
112+
| ``{'sans', 'sans serif', 'sans-serif'}`` | ``'font.sans-serif'`` |
113+
+------------------------------------------+--------------------------------+
116114

117115

118116
which are lists of font names.
119117

120-
Set default font with non-latin code points
121-
===========================================
118+
Text with with non-latin glyphs
119+
===============================
122120

123-
From v2.0 forward the :ref:`default font <default_changes_font>` contains
124-
code points for many western languages, but does not cover eastern
125-
scripts (ex Chinese, Korean, or Japanese). If you use unicode points
126-
not covered by the default font you will see the dreaded 'code point
127-
not found' place holder (typically an empty rectangle). To set the
128-
default font to be one that support the code points you need prepend
129-
the font name to ``'font.family'`` or the desired alias lists ::
121+
As of v2.0 the :ref:`default font <default_changes_font>` contains
122+
glyphs for many western alphabets, but still does not cover all of the
123+
glyphs that may be required by mpl users. For example, DejaVu has no
124+
coverage of Chinese, Korean, or Japanese.
125+
126+
127+
To set the default font to be one that support the code points you
128+
need prepend the font name to ``'font.family'`` or the desired alias
129+
lists ::
130130

131131
matplotlib.rcParams['font.sans-serif'] = ['Source Han Sans TW', 'sans-serif']
132132

133133
or set it in your :file:`.matplotlibrc` file::
134134

135135
font.sans-serif: Source Han Sans TW, Ariel, sans-serif
136136

137+
To control the font used on per-artist basis use the ``'name'``,
138+
``'fontname'`` or ``'fontproperties'`` kwargs documented :ref:`above
139+
<text-properties>`.
140+
137141

138142
On linux `fc-list <http://linux.die.net/man/1/fc-list>`__ can be a
139143
useful tool to discover the font name for example ::

0 commit comments

Comments
 (0)