1010[ ![ GitHub stars] ( https://img.shields.io/github/stars/nschloe/matplotlib2tikz.svg?logo=github&label=Stars&logoColor=white )] ( https://github.com/nschloe/matplotlib2tikz )
1111
1212This is matplotlib2tikz, a Python tool for converting matplotlib figures into
13- [ PGFPlots] ( https://www.ctan.org/pkg/pgfplots )
14- ( [ TikZ ] ( https://www.ctan.org/pkg/pgf ) ) figures like
13+ [ PGFPlots] ( https://www.ctan.org/pkg/pgfplots ) ( [ PGF/TikZ ] ( https://www.ctan.org/pkg/pgf ) )
14+ figures like
1515
1616![ ] ( https://nschloe.github.io/matplotlib2tikz/example.png )
1717
@@ -21,9 +21,11 @@ The output of matplotlib2tikz is in
2121[ PGFPlots] ( http://pgfplots.sourceforge.net/pgfplots.pdf ) , a LaTeX library that sits on
2222top of [ PGF/TikZ] ( https://en.wikipedia.org/wiki/PGF/TikZ ) and describes graphs in terms
2323of axes, data etc. Consequently, the output of matplotlib2tikz
24+
2425 * retains more information,
2526 * can be more easily understood, and
2627 * is more easily editable
28+
2729than [ raw TikZ output] ( https://matplotlib.org/users/whats_new.html#pgf-tikz-backend ) .
2830For example, the matplotlib figure
2931``` python,test
@@ -42,9 +44,9 @@ plt.ylabel("Voltage (mV)")
4244plt.title("Simple plot $\\frac{\\alpha}{2}$")
4345plt.grid(True)
4446
45- from matplotlib2tikz import save as tikz_save
47+ import matplotlib2tikz
4648
47- tikz_save ("test.tex")
49+ matplotlib2tikz.save ("test.tex")
4850```
4951(see above) gives
5052``` latex
@@ -88,21 +90,19 @@ table {%
8890```
8991(Use ` get_tikz_code() ` instead of ` save() ` if you want the code as a string.)
9092
91- Tweaking the plot is straightforward and can be done as part of your LaTeX
92- work flow.
93- [ The fantastic PGFPlots manual] ( http://pgfplots.sourceforge.net/pgfplots.pdf )
94- contains great examples of how to make your plot look even better.
93+ Tweaking the plot is straightforward and can be done as part of your LaTeX work flow.
94+ [ The fantastic PGFPlots manual] ( http://pgfplots.sourceforge.net/pgfplots.pdf ) contains
95+ great examples of how to make your plot look even better.
9596
9697Of course, not all figures produced by matplotlib can be converted without error.
9798Notably, [ 3D plots don't work] ( https://github.com/matplotlib/matplotlib/issues/7243 ) .
9899
99100### Installation
100101
101102matplotlib2tikz is [ available from the Python Package
102- Index] ( https://pypi.org/project/matplotlib2tikz/ ) , so
103- simply type
103+ Index] ( https://pypi.org/project/matplotlib2tikz/ ) , so simply type
104104```
105- pip install -U matplotlib2tikz
105+ pip3 install matplotlib2tikz --user
106106```
107107to install/update.
108108
@@ -137,17 +137,16 @@ to install/update.
137137# ## Contributing
138138
139139If you experience bugs, would like to contribute, have nice examples of what
140- matplotlib2tikz can do, or if you are just looking for more information, then
141- please visit
142- [matplotlib2tikz' s GitHub page](https://github.com/nschloe/matplotlib2tikz).
140+ matplotlib2tikz can do, or if you are just looking for more information, then please
141+ visit [matplotlib2tikz' s GitHub page](https://github.com/nschloe/matplotlib2tikz).
143142
144143
145144# ## Testing
146145
147- matplotlib2tikz has automatic unit testing to make sure that the software
148- doesn ' t accidentally get worse over time. In `test/`, a number of
149- test cases are specified. Those run through matplotlib2tikz and compare the output with
150- a previously stored reference TeX file .
146+ matplotlib2tikz has automatic unit testing to make sure that the software doesn ' t
147+ accidentally get worse over time. In `test/ ` , a number of test cases are specified.
148+ Those run through matplotlib2tikz and compare the output with a previously stored
149+ reference TeX file .
151150
152151To run the tests, just check out this repository and type
153152```
0 commit comments