1
1
# matplotlib2tikz
2
2
3
- [ ![ CircleCI] ( https://circleci.com/gh/ nschloe/matplotlib2tikz.svg?style=svg )] ( https://circleci.com/gh/nschloe/matplotlib2tikz )
3
+ [ ![ CircleCI] ( https://img.shields.io/circleci/project/github/ nschloe/matplotlib2tikz/master .svg )] ( https://circleci.com/gh/nschloe/matplotlib2tikz/tree/master )
4
4
[ ![ codecov] ( https://codecov.io/gh/nschloe/matplotlib2tikz/branch/master/graph/badge.svg )] ( https://codecov.io/gh/nschloe/matplotlib2tikz )
5
5
[ ![ Documentation Status] ( https://readthedocs.org/projects/matplotlib2tikz/badge/?version=latest )] ( https://readthedocs.org/projects/matplotlib2tikz/?badge=latest )
6
6
[ ![ PyPi Version] ( https://img.shields.io/pypi/v/matplotlib2tikz.svg )] ( https://pypi.python.org/pypi/matplotlib2tikz )
7
- [ ![ GitHub stars] ( https://img.shields.io/github/stars/nschloe/matplotlib2tikz.svg?style=social&label=Star&maxAge=2592000 )] ( https://github.com/nschloe/matplotlib2tikz )
7
+ [ ![ awesome] ( https://img.shields.io/badge/awesome-yes-brightgreen.svg )] ( https://img.shields.io/badge/awesome-yes-brightgreen.svg )
8
+ [ ![ GitHub stars] ( https://img.shields.io/github/stars/nschloe/matplotlib2tikz.svg?style=social&label=Stars&maxAge=2592000 )] ( https://github.com/nschloe/matplotlib2tikz )
8
9
9
10
This is matplotlib2tikz, a Python tool for converting matplotlib figures into
10
11
[ PGFPlots] ( https://www.ctan.org/pkg/pgfplots )
@@ -20,7 +21,7 @@ The output of matplotlib2tikz is in
20
21
[ PGFPlots] ( http://pgfplots.sourceforge.net/pgfplots.pdf ) , a LaTeX library that
21
22
sits on top of TikZ and describes graphs in terms of axes, data etc.
22
23
Consequently, the output of matplotlib2tikz retains more information, can be
23
- more easily understood, and is more easily editable than [ raw TikZ output] ( http ://matplotlib.org/users/whats_new.html#pgf-tikz-backend) .
24
+ more easily understood, and is more easily editable than [ raw TikZ output] ( https ://matplotlib.org/users/whats_new.html#pgf-tikz-backend) .
24
25
For example, the matplotlib figure
25
26
``` python,test
26
27
import matplotlib.pyplot as plt
@@ -33,7 +34,7 @@ s = np.sin(2*np.pi*t)
33
34
s2 = np.cos(2*np.pi*t)
34
35
plt.plot(t, s, 'o-', lw=4.1)
35
36
plt.plot(t, s2, 'o-', lw=4.1)
36
- plt.xlabel('time(s)')
37
+ plt.xlabel('time (s)')
37
38
plt.ylabel('Voltage (mV)')
38
39
plt.title('Simple plot $\\frac{\\alpha}{2}$')
39
40
plt.grid(True)
@@ -51,7 +52,7 @@ tikz_save('test.tex')
51
52
52
53
\begin{axis}[
53
54
title={Simple plot $\frac{\alpha}{2}$},
54
- xlabel={time(s)},
55
+ xlabel={time (s)},
55
56
ylabel={Voltage (mV)},
56
57
xmin=-0.095, xmax=1.995,
57
58
ymin=-1.1, ymax=1.1,
@@ -104,7 +105,7 @@ to install/update.
104
105
105
106
2 . Instead of ` pyplot.show() ` , invoke matplotlib2tikz by
106
107
``` python
107
- tikz_save(' mytikz.tex' );
108
+ tikz_save(' mytikz.tex' )
108
109
```
109
110
to store the TikZ file as `mytikz.tex` . Load the library with :
110
111
```python
@@ -123,8 +124,8 @@ to install/update.
123
124
```python
124
125
tikz_save(
125
126
' mytikz.tex' ,
126
- figureheight = ' \\ figureheight' ,
127
- figurewidth = ' \\ figurewidth'
127
+ figureheight = ' \\ figureheight' ,
128
+ figurewidth = ' \\ figurewidth'
128
129
)
129
130
```
130
131
and in the LaTeX source
@@ -180,7 +181,7 @@ pytest
180
181
```
181
182
182
183
The final pHash may depend on any of the tools used during the process. For
183
- example, if your version of [Pillow](https:// pypi.python.org/ pypi/ Pillow/ 3.0 .0)
184
+ example, if your version of [Pillow](https:// pypi.python.org/ pypi/ Pillow/ 4.3 .0)
184
185
is too old, the pHash function might operate slightly differently and produce a
185
186
slightly different pHash, resulting in a failing test. If tests are failing on
186
187
your local machine, you should first make sure to have an up- to- date Pillow.
0 commit comments