Skip to content

Commit 34e0b46

Browse files
Merge branch 'master' into cleanfigure
2 parents 715abbf + b7cb3a0 commit 34e0b46

File tree

105 files changed

+7989
-7098
lines changed

Some content is hidden

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

105 files changed

+7989
-7098
lines changed

.circleci/config.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@ version: 2
33
jobs:
44
lint:
55
docker:
6-
- image: ubuntu:18.04
6+
- image: circleci/python:3.7
77
steps:
88
- checkout
9-
- run: apt update
10-
- run: apt install -y python3-pip
11-
- run: pip3 install -U black flake8
12-
- run: LC_ALL=C.UTF-8 black --check .
9+
- run: pip3 install -U black flake8 --user
10+
- run: black --check .
1311
- run: flake8 .
1412
build:
1513
working_directory: ~/work
1614
docker:
17-
- image: ubuntu:18.04
15+
- image: circleci/python:3.7
1816
steps:
19-
- run: apt update
17+
- run: sudo apt update
2018
# <https://stackoverflow.com/a/44333806/353337>
21-
- run: DEBIAN_FRONTEND=noninteractive apt install tzdata
22-
- run: apt install -y texlive-latex-base texlive-latex-extra python3-pip python3-tk python3-scipy
23-
- run: pip3 install -U pytest pytest-cov excode
19+
- run: DEBIAN_FRONTEND=noninteractive sudo apt install tzdata
20+
- run: sudo apt install -y texlive-latex-base texlive-latex-extra
21+
- run: pip3 install -U pytest pytest-cov excode --user
2422
- checkout
25-
- run: cd ~/work
2623
- run: excode README.md test/zzz_readme_test.py --filter python,test
27-
- run: pip3 install -r test_requirements.txt
28-
- run: pip3 install .[all]
24+
- run: pip3 install -r test_requirements.txt --user
25+
- run: pip3 install .[all] --user
2926
- run: pip3 check
3027
# The actual test
31-
- run: cd test/ && MPLBACKEND=Agg pytest --cov tikzplotlib
28+
- run:
29+
command: pytest --cov tikzplotlib
30+
working_directory: test/
31+
environment:
32+
MPLBACKEND: Agg
3233
# submit to codecov
33-
- run: apt install -y curl
3434
- run: bash <(curl -s https://codecov.io/bash)
3535

3636
workflows:

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
22
ignore = E203, E266, E501, W503
3-
max-line-length = 80
3+
max-line-length = 88
44
max-complexity = 20
55
select = B,C,E,F,W,T4,B9

.github/workflows/test.yml renamed to .github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test
1+
name: ci
22

33
on: [push]
44

@@ -42,5 +42,5 @@ jobs:
4242
pip install pytest pytest-cov
4343
pip install -r test_requirements.txt
4444
cd test/ && MPLBACKEND=Agg pytest --cov tikzplotlib
45-
- name: Submit to codecov
46-
run: bash <(curl -s https://codecov.io/bash) -R ~/work/tikzplotlib
45+
# - name: Submit to codecov
46+
# run: bash <(curl -s https://codecov.io/bash)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2010-2019 Nico Schlömer
3+
Copyright (c) 2010-2020 Nico Schlömer
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ tag:
99
@echo "Tagging v$(VERSION)..."
1010
git tag v$(VERSION)
1111
git push --tags
12+
curl -H "Authorization: token `cat $(HOME)/.github-access-token`" -d '{"tag_name": "$(VERSION)"}' https://api.github.com/repos/nschloe/tikzplotlib/releases
1213

1314
upload: setup.py
1415
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,21 @@ tikzplotlib.save("test.tex")
5959
\definecolor{color1}{rgb}{0.203921568627451,0.541176470588235,0.741176470588235}
6060
6161
\begin{axis}[
62-
axis background/.style={fill=white!89.80392156862746!black},
62+
axis background/.style={fill=white!89.8039215686275!black},
6363
axis line style={white},
6464
tick align=outside,
6565
tick pos=left,
66-
title={Simple plot $\frac{\alpha}{2}$},
66+
title={Simple plot \(\displaystyle \frac{\alpha}{2}\)},
6767
x grid style={white},
6868
xlabel={time (s)},
6969
xmajorgrids,
7070
xmin=-0.095, xmax=1.995,
71+
xtick style={color=white!33.3333333333333!black},
7172
y grid style={white},
7273
ylabel={Voltage (mV)},
7374
ymajorgrids,
74-
ymin=-1.1, ymax=1.1
75+
ymin=-1.1, ymax=1.1,
76+
ytick style={color=white!33.3333333333333!black}
7577
]
7678
\addplot [line width=1.64pt, color0, mark=*, mark size=3, mark options={solid}]
7779
table {%

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# -- Project information -----------------------------------------------------
2020

2121
project = "tikzplotlib"
22-
copyright = "2010-2019, Nico Schlömer"
22+
copyright = "2010-2020, Nico Schlömer"
2323
author = "Nico Schlömer"
2424

2525
# https://packaging.python.org/single_source_version/

setup.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import codecs
21
import os
32

43
from setuptools import find_packages, setup
@@ -10,10 +9,6 @@
109
exec(f.read(), about)
1110

1211

13-
def read(fname):
14-
return codecs.open(os.path.join(base_dir, fname), encoding="utf-8").read()
15-
16-
1712
setup(
1813
name="tikzplotlib",
1914
version=about["__version__"],
@@ -23,10 +18,10 @@ def read(fname):
2318
author_email=about["__email__"],
2419
install_requires=["matplotlib >= 1.4.0", "numpy", "Pillow"],
2520
description="Convert matplotlib figures into TikZ/PGFPlots",
26-
long_description=read("README.md"),
21+
long_description=open("README.md").read(),
2722
long_description_content_type="text/markdown",
2823
license=about["__license__"],
29-
python_requires=">=3",
24+
python_requires=">=3.6",
3025
classifiers=[
3126
about["__status__"],
3227
about["__license__"],

test/helpers.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def print_tree(obj, indent=""):
1818

1919
for child in obj.get_children():
2020
print_tree(child, indent + " ")
21-
return
2221

2322

2423
# https://stackoverflow.com/a/845432/353337
@@ -31,10 +30,12 @@ def _unidiff_output(expected, actual):
3130
return "".join(diff)
3231

3332

34-
def assert_equality(plot, filename, **extra_get_tikz_code_args):
33+
def assert_equality(
34+
plot, filename, assert_compilation=True, **extra_get_tikz_code_args
35+
):
3536
plot()
3637
code = tikzplotlib.get_tikz_code(
37-
include_disclaimer=False, **extra_get_tikz_code_args
38+
include_disclaimer=False, float_format=".8g", **extra_get_tikz_code_args
3839
)
3940
plt.close()
4041

@@ -43,11 +44,13 @@ def assert_equality(plot, filename, **extra_get_tikz_code_args):
4344
reference = f.read()
4445
assert reference == code, _unidiff_output(code, reference)
4546

46-
code = tikzplotlib.get_tikz_code(
47-
include_disclaimer=False, standalone=True, **extra_get_tikz_code_args
48-
)
49-
assert _compile(code) is not None
50-
return
47+
if assert_compilation:
48+
plot()
49+
code = tikzplotlib.get_tikz_code(
50+
include_disclaimer=False, standalone=True, **extra_get_tikz_code_args
51+
)
52+
plt.close()
53+
assert _compile(code) is not None, code
5154

5255

5356
def _compile(code):
@@ -96,4 +99,3 @@ def compare_mpl_latex(plot):
9699
png_path = os.path.join(pdf_dirname, "test-1.png")
97100

98101
os.rename(png_path, os.path.join(directory, "test-1.png"))
99-
return

test/refresh_reference_files.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import matplotlib.pyplot as plt
66

7-
import tikzplotlib as m2t
7+
import tikzplotlib as tpl
88

99

1010
def _main():
@@ -24,13 +24,12 @@ def _main():
2424
spec.loader.exec_module(module)
2525
module.plot()
2626

27-
code = m2t.get_tikz_code(include_disclaimer=False)
27+
code = tpl.get_tikz_code(include_disclaimer=False, float_format=".8g")
2828
plt.close()
2929

3030
tex_filename = filename[:-3] + "_reference.tex"
31-
with open(os.path.join(this_dir, tex_filename), "w") as f:
31+
with open(os.path.join(this_dir, tex_filename), "w", encoding="utf8") as f:
3232
f.write(code)
33-
return
3433

3534

3635
if __name__ == "__main__":

0 commit comments

Comments
 (0)