Skip to content

Commit 987c95e

Browse files
committed
Update README, text hinting example.
1 parent 939edba commit 987c95e

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

README.rst

+12-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Installation
1414

1515
Dependencies:
1616
- Python 3,
17-
- cairo >=1.12,
17+
- cairo >=1.12 (needed for mesh gradient support),
1818
- a C++ compiler with C++17 support, e.g. GCC≥7.1.
1919

2020
Run::
@@ -34,9 +34,9 @@ Run::
3434
Then, the backend can be selected by setting the ``MPLBACKEND`` environment
3535
variable to ``module://mpl_cairo.qt``.
3636

37-
The ``examples`` folder contains a few cases where the output of this backend
38-
is arguably more accurate (thanks to the use of subpixel marker stamping, with
39-
an accuracy controlled by the ``path.simplify_threshold`` rcparam).
37+
The ``examples`` folder contains a few cases where the output of this renderer
38+
is arguably more accurate than the one of the default renderer, Agg (better and
39+
faster marker stamping, and better text kerning).
4040

4141
Benchmarks
4242
----------
@@ -61,6 +61,14 @@ Notes
6161
artist property can also take the ``mpl_cairo.antialias_t.GOOD`` (or
6262
``BEST``, etc.) value for additional control. ``GOOD``/``BEST`` antialiasing
6363
of lines is ~3x slower than using Agg.
64+
65+
**NOTE**: When drawing very thin lines (e.g.,
66+
``test_cycles.test_property_collision_plot``), ``CAIRO_ANTIALIAS_FAST`` may
67+
lead to artefacts, such that the line disappears in certain areas. In that
68+
case, switching to ``GOOD``/``BEST`` antialiasing solves the issue. (It may
69+
be possible to do this automatically from within the backend, just as the
70+
miter limit is set whenever the line width is set.)
71+
6472
- ``path.simplify_threshold`` is also used to control the accuracy of marker
6573
stamping, down to a arbitrarily chosen threshold of 1/16px. Values lower
6674
than that will use the exact (slower) marker drawing path. Marker stamping

examples/circle_markers.py

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import matplotlib.pyplot as plt
55
import numpy as np
66
import time
7+
backend = plt.rcParams["backend"]
8+
plt.rcdefaults()
9+
plt.rcParams["backend"] = backend
710

811

912
def generate(X, Y, phi):

examples/square_markers.py

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import matplotlib.pyplot as plt
55
import numpy as np
66
import time
7+
backend = plt.rcParams["backend"]
8+
plt.rcdefaults()
9+
plt.rcParams["backend"] = backend
710

811

912
def generate(X, Y, phi):

examples/text_kerning.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from matplotlib import pyplot as plt
2+
backend = plt.rcParams["backend"]
3+
plt.rcdefaults()
4+
plt.rcParams["backend"] = backend
5+
fig, ax = plt.subplots()
6+
7+
ax.text(.5, .5, "line")
8+
plt.show()

0 commit comments

Comments
 (0)