Skip to content

Commit 1e922e6

Browse files
authored
Merge pull request nschloe#306 from nschloe/python3-and-rename
Python3 and rename
2 parents 0809419 + 736241d commit 1e922e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+111
-288
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
- run: apt update
1010
- run: apt install -y python3-pip
1111
- run: pip3 install -U black flake8
12-
- run: LC_ALL=C.UTF-8 black --check setup.py matplotlib2tikz/ test/*.py
13-
- run: flake8 setup.py matplotlib2tikz/ test/*.py
12+
- run: LC_ALL=C.UTF-8 black --check setup.py tikzplotlib/ test/*.py
13+
- run: flake8 setup.py tikzplotlib/ test/*.py
1414
build:
1515
working_directory: ~/work
1616
docker:
@@ -28,7 +28,7 @@ jobs:
2828
- run: pip3 install .[all]
2929
- run: pip3 check
3030
# The actual test
31-
- run: cd test/ && MPLBACKEND=Agg pytest --cov matplotlib2tikz
31+
- run: cd test/ && MPLBACKEND=Agg pytest --cov tikzplotlib
3232
# submit to codecov
3333
- run: apt install -y curl
3434
- run: bash <(curl -s https://codecov.io/bash)

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ before_script:
5252

5353
# run tests
5454
script:
55-
- pylint matplotlib2tikz/
55+
- pylint tikzplotlib/
5656
- pylint test/*py
5757
# cd into test directory to make sure we're using the pip-installed
58-
# matplotlib2tikz.
59-
- cd test && MPLBACKEND=Agg pytest --cov matplotlib2tikz
58+
# tikzplotlib.
59+
- cd test && MPLBACKEND=Agg pytest --cov tikzplotlib
6060

6161
after_success:
6262
- bash <(curl -s https://codecov.io/bash)

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=$(shell python3 -c "import matplotlib2tikz; print(matplotlib2tikz.__version__)")
1+
VERSION=$(shell python3 -c "import tikzplotlib; print(tikzplotlib.__version__)")
22

33
default:
44
@echo "\"make publish\"?"
@@ -23,9 +23,13 @@ clean:
2323
@find . | grep -E "(__pycache__|\.pyc|\.pyo$\)" | xargs rm -rf
2424
@rm -rf *.egg-info/ build/ dist/ MANIFEST
2525

26+
format:
27+
isort -rc .
28+
black .
29+
2630
black:
27-
black setup.py matplotlib2tikz/ test/*.py
31+
black .
2832

2933
lint:
30-
black --check setup.py matplotlib2tikz/ test/*.py
31-
flake8 setup.py matplotlib2tikz/ test/*.py
34+
black --check .
35+
flake8 setup.py tikzplotlib/ test/*.py

README.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
# matplotlib2tikz
2-
3-
[![CircleCI](https://img.shields.io/circleci/project/github/nschloe/matplotlib2tikz/master.svg)](https://circleci.com/gh/nschloe/matplotlib2tikz/tree/master)
4-
[![codecov](https://img.shields.io/codecov/c/github/nschloe/matplotlib2tikz.svg)](https://codecov.io/gh/nschloe/matplotlib2tikz)
5-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
6-
[![Documentation Status](https://readthedocs.org/projects/matplotlib2tikz/badge/?version=latest)](https://readthedocs.org/projects/matplotlib2tikz/?badge=latest)
7-
[![awesome](https://img.shields.io/badge/awesome-yes-brightgreen.svg)](https://github.com/nschloe/matplotlib2tikz)
8-
[![PyPi Version](https://img.shields.io/pypi/v/matplotlib2tikz.svg)](https://pypi.org/project/matplotlib2tikz)
9-
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1173089.svg)](https://doi.org/10.5281/zenodo.1173089)
10-
[![GitHub stars](https://img.shields.io/github/stars/nschloe/matplotlib2tikz.svg?logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/matplotlib2tikz)
11-
[![PyPi downloads](https://img.shields.io/pypi/dd/matplotlib2tikz.svg)](https://pypistats.org/packages/matplotlib2tikz)
12-
13-
This is matplotlib2tikz, a Python tool for converting matplotlib figures into
1+
<p align="center">
2+
<img alt="tikzplotlib" src="https://nschloe.github.io/tikzplotlib/logo-tikzplotlib.svg" width="60%">
3+
</p>
4+
5+
[![CircleCI](https://img.shields.io/circleci/project/github/nschloe/tikzplotlib/master.svg?style=flat-square)](https://circleci.com/gh/nschloe/tikzplotlib/tree/master)
6+
[![codecov](https://img.shields.io/codecov/c/github/nschloe/tikzplotlib.svg?style=flat-square)](https://codecov.io/gh/nschloe/tikzplotlib)
7+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/ambv/black)
8+
[![Documentation Status](https://readthedocs.org/projects/tikzplotlib/badge/?version=latest&style=flat-square)](https://readthedocs.org/projects/tikzplotlib/?badge=latest)
9+
[![awesome](https://img.shields.io/badge/awesome-yes-brightgreen.svg?style=flat-square)](https://github.com/nschloe/tikzplotlib)
10+
[![PyPi Version](https://img.shields.io/pypi/v/tikzplotlib.svg?style=flat-square)](https://pypi.org/project/tikzplotlib)
11+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1173089.svg?style=flat-square)](https://doi.org/10.5281/zenodo.1173089)
12+
[![GitHub stars](https://img.shields.io/github/stars/nschloe/tikzplotlib.svg?style=flat-square&logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/tikzplotlib)
13+
[![PyPi downloads](https://img.shields.io/pypi/dd/tikzplotlib.svg?style=flat-square)](https://pypistats.org/packages/tikzplotlib)
14+
15+
This is tikzplotlib, a Python tool for converting matplotlib figures into
1416
[PGFPlots](https://www.ctan.org/pkg/pgfplots) ([PGF/TikZ](https://www.ctan.org/pkg/pgf))
1517
figures like
1618

17-
![](https://nschloe.github.io/matplotlib2tikz/example.png)
19+
![](https://nschloe.github.io/tikzplotlib/example.png)
1820

1921
for native inclusion into LaTeX documents.
2022

21-
The output of matplotlib2tikz is in
23+
The output of tikzplotlib is in
2224
[PGFPlots](http://pgfplots.sourceforge.net/pgfplots.pdf), a LaTeX library that sits on
2325
top of [PGF/TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) and describes graphs in terms
24-
of axes, data etc. Consequently, the output of matplotlib2tikz
26+
of axes, data etc. Consequently, the output of tikzplotlib
2527

2628
* retains more information,
2729
* can be more easily understood, and
@@ -45,9 +47,9 @@ plt.ylabel("Voltage (mV)")
4547
plt.title("Simple plot $\\frac{\\alpha}{2}$")
4648
plt.grid(True)
4749
48-
import matplotlib2tikz
50+
import tikzplotlib
4951
50-
matplotlib2tikz.save("test.tex")
52+
tikzplotlib.save("test.tex")
5153
```
5254
(see above) gives
5355
```latex
@@ -100,10 +102,10 @@ Notably, [3D plots don't work](https://github.com/matplotlib/matplotlib/issues/7
100102

101103
### Installation
102104

103-
matplotlib2tikz is [available from the Python Package
104-
Index](https://pypi.org/project/matplotlib2tikz/), so simply type
105+
tikzplotlib is [available from the Python Package
106+
Index](https://pypi.org/project/tikzplotlib/), so simply type
105107
```
106-
pip3 install matplotlib2tikz --user
108+
pip3 install tikzplotlib --user
107109
```
108110
to install/update.
109111

@@ -112,10 +114,10 @@ to install/update.
112114

113115
1. Generate your matplotlib plot as usual.
114116

115-
2. Instead of `pyplot.show()`, invoke matplotlib2tikz by
117+
2. Instead of `pyplot.show()`, invoke tikzplotlib by
116118
```python
117-
import matplotlib2tikz
118-
matplotlib2tikz.save("mytikz.tex")
119+
import tikzplotlib
120+
tikzplotlib.save("mytikz.tex")
119121
```
120122
to store the TikZ file as `mytikz.tex`.
121123

@@ -138,15 +140,15 @@ to install/update.
138140
### Contributing
139141

140142
If you experience bugs, would like to contribute, have nice examples of what
141-
matplotlib2tikz can do, or if you are just looking for more information, then please
142-
visit [matplotlib2tikz's GitHub page](https://github.com/nschloe/matplotlib2tikz).
143+
tikzplotlib can do, or if you are just looking for more information, then please
144+
visit [tikzplotlib's GitHub page](https://github.com/nschloe/tikzplotlib).
143145

144146

145147
### Testing
146148

147-
matplotlib2tikz has automatic unit testing to make sure that the software doesn't
149+
tikzplotlib has automatic unit testing to make sure that the software doesn't
148150
accidentally get worse over time. In `test/`, a number of test cases are specified.
149-
Those run through matplotlib2tikz and compare the output with a previously stored
151+
Those run through tikzplotlib and compare the output with a previously stored
150152
reference TeX file.
151153

152154
To run the tests, just check out this repository and type
@@ -156,4 +158,4 @@ pytest
156158

157159
### License
158160

159-
matplotlib2tikz is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).
161+
tikzplotlib is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).

doc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ qthelp:
6161
@echo
6262
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
6363
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
64-
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/matplotlib2tikz.qhcp"
64+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/tikzplotlib.qhcp"
6565
@echo "To view the help file:"
66-
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/matplotlib2tikz.qhc"
66+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/tikzplotlib.qhc"
6767

6868
latex:
6969
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex

doc/conf.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# matplotlib2tikz documentation build configuration file, created by
1+
# tikzplotlib documentation build configuration file, created by
42
# sphinx-quickstart on Mon May 10 14:00:31 2010.
53
#
64
# This file is execfile()d with the current directory set to its containing
@@ -12,8 +10,8 @@
1210
# All configuration values have a default; values that are commented out
1311
# serve to show the default.
1412

15-
import sys
1613
import os
14+
import sys
1715

1816
import mock
1917

@@ -51,7 +49,7 @@
5149
master_doc = "index"
5250

5351
# General information about the project.
54-
project = u"matplotlib2tikz"
52+
project = u"tikzplotlib"
5553
copyright = u"2010-2018, Nico Schlömer"
5654

5755
# The version info for the project you're documenting, acts as replacement for
@@ -61,7 +59,7 @@
6159
# https://packaging.python.org/single_source_version/
6260
this_dir = os.path.abspath(os.path.dirname(__file__))
6361
about = {}
64-
about_file = os.path.join(this_dir, "..", "matplotlib2tikz", "__about__.py")
62+
about_file = os.path.join(this_dir, "..", "tikzplotlib", "__about__.py")
6563
with open(about_file) as f:
6664
exec(f.read(), about)
6765
# The short X.Y version.
@@ -179,7 +177,7 @@
179177
# html_file_suffix = ''
180178

181179
# Output file base name for HTML help builder.
182-
htmlhelp_basename = "matplotlib2tikzdoc"
180+
htmlhelp_basename = "tikzplotlibdoc"
183181

184182

185183
# -- Options for LaTeX output -------------------------------------------------
@@ -195,8 +193,8 @@
195193
latex_documents = [
196194
(
197195
"index",
198-
"matplotlib2tikz.tex",
199-
u"matplotlib2tikz Documentation",
196+
"tikzplotlib.tex",
197+
u"tikzplotlib Documentation",
200198
u"Nico Schlömer",
201199
"manual",
202200
)

doc/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
.. matplotlib2tikz documentation master file, created by
1+
.. tikzplotlib documentation master file, created by
22
sphinx-quickstart on Mon May 10 14:00:31 2010.
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to matplotlib2tikz's documentation!
6+
Welcome to tikzplotlib's documentation!
77
===========================================
88

99
Contents:
@@ -14,7 +14,7 @@ Contents:
1414
Methods
1515
=======
1616

17-
.. automodule:: matplotlib2tikz
17+
.. automodule:: tikzplotlib
1818
:members:
1919

2020
Indices and tables

matplotlib2tikz/__about__.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

setup.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
import codecs
42
import os
53

6-
from setuptools import setup, find_packages
4+
from setuptools import find_packages, setup
75

86
# https://packaging.python.org/single_source_version/
97
base_dir = os.path.abspath(os.path.dirname(__file__))
108
about = {}
11-
with open(os.path.join(base_dir, "matplotlib2tikz", "__about__.py"), "rb") as f:
9+
with open(os.path.join(base_dir, "tikzplotlib", "__about__.py"), "rb") as f:
1210
exec(f.read(), about)
1311

1412

@@ -17,21 +15,18 @@ def read(fname):
1715

1816

1917
setup(
20-
name="matplotlib2tikz",
18+
name="tikzplotlib",
2119
version=about["__version__"],
2220
packages=find_packages(),
23-
url="https://github.com/nschloe/matplotlib2tikz",
21+
url="https://github.com/nschloe/tikzplotlib",
2422
author=about["__author__"],
2523
author_email=about["__email__"],
26-
install_requires=["matplotlib >= 1.4.0", "numpy", "Pillow", "six"],
27-
extras_require={
28-
"all": ["pipdate >= 0.3.0, <0.4.0"],
29-
"update": ["pipdate >= 0.3.0, <0.4.0"],
30-
},
24+
install_requires=["matplotlib >= 1.4.0", "numpy", "Pillow"],
3125
description="Convert matplotlib figures into TikZ/PGFPlots",
3226
long_description=read("README.md"),
3327
long_description_content_type="text/markdown",
3428
license=about["__license__"],
29+
python_requires=">=3",
3530
classifiers=[
3631
about["__status__"],
3732
about["__license__"],

test/helpers.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
import os
42
import subprocess
53
import tempfile
64

75
import matplotlib
86
import matplotlib.pyplot as plt
97

10-
import matplotlib2tikz
8+
import tikzplotlib
119

1210

1311
def print_tree(obj, indent=""):
@@ -35,7 +33,7 @@ def _unidiff_output(expected, actual):
3533

3634
def assert_equality(plot, filename, **extra_get_tikz_code_args):
3735
plot()
38-
code = matplotlib2tikz.get_tikz_code(
36+
code = tikzplotlib.get_tikz_code(
3937
include_disclaimer=False, **extra_get_tikz_code_args
4038
)
4139
plt.close()
@@ -45,7 +43,7 @@ def assert_equality(plot, filename, **extra_get_tikz_code_args):
4543
reference = f.read()
4644
assert reference == code, _unidiff_output(code, reference)
4745

48-
code = matplotlib2tikz.get_tikz_code(
46+
code = tikzplotlib.get_tikz_code(
4947
include_disclaimer=False, standalone=True, **extra_get_tikz_code_args
5048
)
5149
assert _compile(code) is not None
@@ -82,7 +80,7 @@ def _compile(code):
8280

8381
def compare_mpl_latex(plot):
8482
plot()
85-
code = matplotlib2tikz.get_tikz_code(standalone=True)
83+
code = tikzplotlib.get_tikz_code(standalone=True)
8684
directory = os.getcwd()
8785
filename = "test-0.png"
8886
plt.savefig(filename)

test/refresh_reference_files.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
import argparse
4-
import os
52
import importlib.util
3+
import os
64

7-
import matplotlib2tikz as m2t
85
import matplotlib.pyplot as plt
96

7+
import tikzplotlib as m2t
8+
109

1110
def _main():
1211
parser = argparse.ArgumentParser(description="Refresh the reference TeX files.")

test/rotated_labels.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
desc = "Rotated labels"
42
phash = "a91fa2a3713dcc0b"
53

test/test_annotate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
import matplotlib.pyplot as plt
42
import numpy as np
53

test/test_arrows.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
import matplotlib.patches as mpatches
42
import matplotlib.pyplot as plt
53

@@ -64,8 +62,8 @@ def to_texstring(s):
6462
# # plt.show()
6563
#
6664
# plot()
67-
# import matplotlib2tikz
68-
# code = matplotlib2tikz.get_tikz_code(include_disclaimer=False, standalone=True)
65+
# import tikzplotlib
66+
# code = tikzplotlib.get_tikz_code(include_disclaimer=False, standalone=True)
6967
# plt.close()
7068
# helpers._does_compile(code)
7169

0 commit comments

Comments
 (0)