Skip to content

Commit fc922db

Browse files
authored
Merge pull request #171 from nschloe/remove-landscape-badge
Remove landscape badge
2 parents f66bd9d + 8cbc9b1 commit fc922db

Some content is hidden

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

45 files changed

+276
-194
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ addons:
3131
- python-tk
3232

3333
before_install:
34-
- pip install pytest pytest-cov
34+
- pip install pytest pytest-cov code_extract
35+
# Make sure to put the readme test at the very end; otherwise it's messing
36+
# around with the other tests.
37+
- code_extract README.md test/zzz_readme_test.py --filter python,test
3538

3639
install:
3740
- pip install -r test_requirements.txt

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ default:
1010

1111
README.rst: README.md
1212
pandoc README.md -o README.rst
13+
sed -i 's/python,test/python/g' README.rst
1314
python setup.py check -r -s || exit 1
1415

1516
upload: setup.py README.rst

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# matplotlib2tikz
22

33
[![Build Status](https://travis-ci.org/nschloe/matplotlib2tikz.svg?branch=master)](https://travis-ci.org/nschloe/matplotlib2tikz)
4-
[![Code Health](https://landscape.io/github/nschloe/matplotlib2tikz/master/landscape.png)](https://landscape.io/github/nschloe/matplotlib2tikz/master)
54
[![codecov](https://codecov.io/gh/nschloe/matplotlib2tikz/branch/master/graph/badge.svg)](https://codecov.io/gh/nschloe/matplotlib2tikz)
65
[![Documentation Status](https://readthedocs.org/projects/matplotlib2tikz/badge/?version=latest)](https://readthedocs.org/projects/matplotlib2tikz/?badge=latest)
76
[![PyPi Version](https://img.shields.io/pypi/v/matplotlib2tikz.svg)](https://pypi.python.org/pypi/matplotlib2tikz)
@@ -11,7 +10,7 @@ This is matplotlib2tikz, a Python tool for converting matplotlib figures into
1110
[PGFPlots](https://www.ctan.org/pkg/pgfplots)
1211
([TikZ](https://www.ctan.org/pkg/pgf)) figures like
1312

14-
![](https://nschloe.github.io/matplotlib2tikz/latex3.png)
13+
![](https://nschloe.github.io/matplotlib2tikz/example.png)
1514

1615
for native inclusion into LaTeX documents.
1716

@@ -21,12 +20,12 @@ sits on top of TikZ and describes graphs in terms of axes, data etc.
2120
Consequently, the output of matplotlib2tikz retains more information, can be
2221
more easily understood, and is more easily editable than [raw TikZ output](http://matplotlib.org/users/whats_new.html#pgf-tikz-backend).
2322
For example, the matplotlib figure
24-
```python
25-
from matplotlib import pyplot as plt
26-
from matplotlib import style
23+
```python,test
24+
import matplotlib.pyplot as plt
2725
import numpy as np
28-
fig = plt.figure()
29-
style.use('ggplot')
26+
27+
plt.style.use('ggplot')
28+
3029
t = np.arange(0.0, 2.0, 0.1)
3130
s = np.sin(2*np.pi*t)
3231
s2 = np.cos(2*np.pi*t)
@@ -52,24 +51,25 @@ tikz_save('test.tex')
5251
title={Simple plot $\frac{\alpha}{2}$},
5352
xlabel={time(s)},
5453
ylabel={Voltage (mV)},
55-
xmin=0, xmax=2,
56-
ymin=-1, ymax=1,
54+
xmin=-0.095, xmax=1.995,
55+
ymin=-1.1, ymax=1.1,
5756
tick align=outside,
57+
tick pos=left,
5858
xmajorgrids,
5959
x grid style={white},
6060
ymajorgrids,
6161
y grid style={white},
6262
axis line style={white},
6363
axis background/.style={fill=white!89.803921568627459!black}
6464
]
65-
\addplot [line width=1.64pt, color0, mark=*, mark size=3, mark options={solid,draw=black}]
65+
\addplot [line width=1.64pt, color0, mark=*, mark size=3, mark options={solid}]
6666
table {%
6767
0 0
6868
0.1 0.587785252292473
6969
% [...]
7070
1.9 -0.587785252292473
7171
};
72-
\addplot [line width=1.64pt, color1, mark=*, mark size=3, mark options={solid,draw=black}]
72+
\addplot [line width=1.64pt, color1, mark=*, mark size=3, mark options={solid}]
7373
table {%
7474
0 1
7575
0.1 0.809016994374947

matplotlib2tikz/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
__copyright__ = 'Copyright (c) 2010-2017, %s <%s>' % (__author__, __email__)
66
__credits__ = []
77
__license__ = 'License :: OSI Approved :: MIT License'
8-
__version__ = '0.6.7'
8+
__version__ = '0.6.8'
99
__maintainer__ = u'Nico Schlömer'
1010
__status__ = 'Development Status :: 5 - Production/Stable'

matplotlib2tikz/axes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def __init__(self, data, obj):
346346
data, 'minor y', colorbar_ticks_minor,
347347
colorbar_ticklabels_minor)
348348
)
349-
colorbar_styles.append('ylabel={'+ colorbar_ylabel +'}')
349+
colorbar_styles.append('ylabel={' + colorbar_ylabel + '}')
350350

351351
mycolormap, is_custom_cmap = _mpl_cmap2pgf_cmap(
352352
colorbar.get_cmap()
@@ -390,8 +390,9 @@ def __get_label_rotation_and_horizontal_alignment(self, obj, data, axes):
390390
tick_label_text_width = None
391391
tick_label_text_width_identifier = "%s tick label text width" % axes
392392
if tick_label_text_width_identifier in data['extra axis options']:
393-
tick_label_text_width = data['extra axis options [base]'] \
394-
[tick_label_text_width_identifier]
393+
tick_label_text_width = data['extra axis options [base]'][
394+
tick_label_text_width_identifier
395+
]
395396
del data['extra axis options'][tick_label_text_width_identifier]
396397

397398
label_style = ""

matplotlib2tikz/line2d.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from . import color as mycol
44
from . import path as mypath
55

6+
import six
7+
68

79
def draw_line2d(data, obj):
810
'''Returns the PGFPlots code for an Line2D environment.
@@ -58,7 +60,9 @@ def draw_line2d(data, obj):
5860
mark_options = ['solid']
5961
if extra_mark_options:
6062
mark_options.append(extra_mark_options)
61-
if marker_face_color in [None, 'none']:
63+
if marker_face_color is None or \
64+
(isinstance(marker_face_color, six.string_types) and
65+
marker_face_color == 'none'):
6266
mark_options.append('fill opacity=0')
6367
else:
6468
data, face_xcolor, _ = mycol.mpl_color2xcolor(

matplotlib2tikz/patch.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,21 @@ def _draw_rectangle(data, obj, draw_options):
6363

6464
# get real label, bar charts by default only give rectangles
6565
# labels of "_nolegend_"
66-
# See http://stackoverflow.com/questions/35881290/how-to-get-the-label-on-bar-plot-stacked-bar-plot-in-matplotlib
67-
handles,labels = obj.axes.get_legend_handles_labels()
68-
labelsFound = [label for h,label in zip(handles, labels) if obj in h.get_children()]
66+
# See
67+
# <http://stackoverflow.com/questions/35881290/how-to-get-the-label-on-bar-plot-stacked-bar-plot-in-matplotlib>
68+
handles, labels = obj.axes.get_legend_handles_labels()
69+
labelsFound = [
70+
label for h, label in zip(handles, labels) if obj in h.get_children()
71+
]
6972
if len(labelsFound) == 1:
7073
label = labelsFound[0]
7174

7275
legend = ''
7376
if label != '_nolegend_' and label not in data['rectangle_legends']:
7477
data['rectangle_legends'].add(label)
75-
legend = ('\\addlegendimage{ybar,ybar legend,%s};\n'
76-
) % (','.join(draw_options))
78+
legend = (
79+
'\\addlegendimage{ybar,ybar legend,%s};\n'
80+
) % (','.join(draw_options))
7781

7882
left_lower_x = obj.get_x()
7983
left_lower_y = obj.get_y()

matplotlib2tikz/save.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def _print_pgfplot_libs_message(data):
235235
print('=========================================================')
236236
return
237237

238+
238239
class _ContentManager(object):
239240
""" Basic Content Manager for matplotlib2tikz
240241

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def read(fname):
3535
'numpy',
3636
'Pillow >= 3.0.0',
3737
'pipdated',
38+
'six',
3839
],
3940
description='convert matplotlib figures into TikZ/PGFPlots',
4041
long_description=read('README.rst'),

0 commit comments

Comments
 (0)