Skip to content

Commit c209462

Browse files
authored
Merge pull request #281 from nschloe/remove-prints
remove superfluous print() statements
2 parents 19aba5e + 05be9ca commit c209462

File tree

3 files changed

+11
-35
lines changed

3 files changed

+11
-35
lines changed

matplotlib2tikz/axes.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -124,26 +124,11 @@ def __init__(self, data, obj):
124124
if colorbar:
125125
self._colorbar(colorbar, data)
126126

127-
# actually print the thing
128127
if self.is_subplot:
129128
self.content.append("\n\\nextgroupplot")
130129
else:
131130
self.content.append("\\begin{axis}")
132131

133-
# # anchors
134-
# if hasattr(obj, '_matplotlib2tikz_anchors'):
135-
# try:
136-
# for coord, anchor_name in obj._matplotlib2tikz_anchors:
137-
# self.content.append(
138-
# '\\node (%s) at (axis cs:%e,%e) {};\n' %
139-
# (anchor_name, coord[0], coord[1])
140-
# )
141-
# except:
142-
# print('Axes attribute _matplotlib2tikz_anchors wrongly set:'
143-
# 'Expected a list of ((x,y), anchor_name), got \'%s\''
144-
# % str(obj._matplotlib2tikz_anchors)
145-
# )
146-
147132
return
148133

149134
def get_begin_code(self):
@@ -466,6 +451,8 @@ def _get_label_rotation_and_horizontal_alignment(obj, data, x_or_y):
466451
)
467452
)
468453

454+
# Ignore horizontal alignment if no '{x,y} tick label text width' has
455+
# been passed in the 'extra' parameter
469456
if tick_label_text_width:
470457
if tick_labels_horizontal_alignment_same_value:
471458
values.append("align={}".format(tick_labels_horizontal_alignment[0]))
@@ -482,14 +469,6 @@ def _get_label_rotation_and_horizontal_alignment(obj, data, x_or_y):
482469
)
483470
)
484471
values.append("text width={}".format(tick_label_text_width))
485-
else:
486-
print(
487-
(
488-
"Horizontal alignment will be ignored as no '{} tick "
489-
"label text width' has been passed in the 'extra' "
490-
"parameter"
491-
).format(x_or_y)
492-
)
493472

494473
label_style = (
495474
"every {} tick label/.style = {{\n"

matplotlib2tikz/line2d.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,23 @@ def _mpl_marker2pgfp_marker(data, mpl_marker, marker_face_color):
252252
# try default list
253253
try:
254254
pgfplots_marker = _MP_MARKER2PGF_MARKER[mpl_marker]
255+
except KeyError:
256+
pass
257+
else:
255258
if (marker_face_color is not None) and pgfplots_marker == "o":
256259
pgfplots_marker = "*"
257260
data["tikz libs"].add("plotmarks")
258261
marker_options = None
259262
return (data, pgfplots_marker, marker_options)
260-
except KeyError:
261-
pass
263+
262264
# try plotmarks list
263265
try:
264266
data["tikz libs"].add("plotmarks")
265267
pgfplots_marker, marker_options = _MP_MARKER2PLOTMARKS[mpl_marker]
268+
except KeyError:
269+
# There's no equivalent for the pixel marker (,) in Pgfplots.
270+
pass
271+
else:
266272
if (
267273
marker_face_color is not None
268274
and (
@@ -273,12 +279,6 @@ def _mpl_marker2pgfp_marker(data, mpl_marker, marker_face_color):
273279
):
274280
pgfplots_marker += "*"
275281
return (data, pgfplots_marker, marker_options)
276-
except KeyError:
277-
pass
278-
279-
# There's no equivalent for the pixel marker in Pgfplots.
280-
if mpl_marker == ",":
281-
print("Unsupported marker " "," " (pixel).")
282282

283283
return data, None, None
284284

matplotlib2tikz/text.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ def _annotation(obj, data, content):
144144
ann_xytext = obj.xyann
145145
ann_textcoords = obj.anncoords
146146
if ann_xycoords != "data" or ann_textcoords != "data":
147-
print(
148-
"Warning: Anything else except for explicit positioning "
149-
"is not supported for annotations yet :("
150-
)
147+
# Anything else except for explicit positioning is not supported yet
151148
return data, content
152149
else: # Create a basic tikz arrow
153150
arrow_translate = {

0 commit comments

Comments
 (0)