Skip to content

Commit 4f89d87

Browse files
committed
Add some docs.
1 parent ff62e9e commit 4f89d87

File tree

4 files changed

+74
-3
lines changed

4 files changed

+74
-3
lines changed

LICENSE.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2017 Antony Lee
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7+
of the Software, and to permit persons to whom the Software is furnished to do
8+
so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.rst

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
A (new) cairo backend for Matplotlib
2+
====================================
3+
4+
This is a new implementation of a Cairo backend for Matplotlib. Currently, it
5+
is designed to be used with the qt-cairo backend proposed in Matplotlib's
6+
PR #8771.
7+
8+
Installation
9+
------------
10+
11+
Only Python 3 is supported. A very recent C++ compiler, with support for C++17
12+
(e.g., GCC 7.1) is required.
13+
14+
Run::
15+
16+
$ python -mvenv /path/to/venv
17+
$ source /path/to/venv/bin/activate
18+
$ git clone https://github.com/matplotlib/matplotlib.git
19+
$ git pull origin pull/8771/head:pr/8771
20+
$ git checkout pr/8771
21+
$ pip install -ve .
22+
$ git clone https://github.com/anntzer/mpl_cairo.git
23+
$ pip install .
24+
25+
Then, run, e.g.::
26+
27+
import mpl_cairo; mpl_cairo.install()
28+
import matplotlib; matplotlib.use("qt5cairo")
29+
30+
data = [[0.5, 0.525, 0.55, 0.575, 0.6, 0.625],
31+
[0.5, 0.501, 0.502, 0.503, 0.504, 0.505]]
32+
33+
fig, ax = plt.subplots(figsize=(3.5, 3.5))
34+
fig.subplots_adjust(
35+
left=0.01, right=0.99, bottom=0.01, top=0.99, hspace=0, wspace=0)
36+
ax.set(xlim=(0, 1), ylim=(0, 1))
37+
ax.scatter(data[0], data[1], s=25)
38+
39+
and compare the marker position with the default ``qt5agg`` backend.
40+
41+
What about the already existing cairo (gtk3cairo) backend?
42+
----------------------------------------------------------
43+
44+
It is slow (try running ``examples/mplot3d/wire3d_animation.py``), buggy (try
45+
calling ``imshow``, especially with an alpha channel), and renders math poorly
46+
(try ``title(r"\sqrt{2}")``).

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import sys
2+
13
from setuptools import setup, Extension
24
from setuptools.command.build_ext import build_ext
3-
import sys
4-
import setuptools
55

66

77
__version__ = "0.0"
@@ -56,7 +56,7 @@ def build_extensions(self):
5656
name="mpl_cairo",
5757
version=__version__,
5858
author="Antony Lee",
59-
description="A cairo backend for matplotlib.",
59+
description="A (new) cairo backend for Matplotlib.",
6060
long_description="",
6161
ext_modules=ext_modules,
6262
install_requires=["pybind11"],

src/_mpl_cairo.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// Missing methods:
2+
// - draw_markers
3+
// - draw_path_collection
4+
// - draw_quad_mesh
5+
// - draw_gouraud_triangle{,s}
6+
17
#include <cmath>
28
#include <tuple>
39
#include <vector>

0 commit comments

Comments
 (0)