Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,44 +1765,3 @@ def update_offset(self, dx, dy):
ann = self.annotation
ann.xyann = ann.get_transform().inverted().transform(
(self.ox + dx, self.oy + dy))


if __name__ == "__main__":
import matplotlib.pyplot as plt
fig = plt.figure()
ax = plt.subplot(121)

#txt = ax.text(0.5, 0.5, "Test", size=30, ha="center", color="w")
kwargs = dict()

a = np.arange(256).reshape(16, 16) / 256.
myimage = OffsetImage(a,
zoom=2,
norm=None,
origin=None,
**kwargs
)
ax.add_artist(myimage)

myimage.set_offset((100, 100))

myimage2 = OffsetImage(a,
zoom=2,
norm=None,
origin=None,
**kwargs
)
ann = AnnotationBbox(myimage2, (0.5, 0.5),
xybox=(30, 30),
xycoords='data',
boxcoords="offset points",
frameon=True, pad=0.4, # BboxPatch
bboxprops=dict(boxstyle="round", fc="y"),
fontsize=None,
arrowprops=dict(arrowstyle="->"),
)

ax.add_artist(ann)

plt.draw()
plt.show()
14 changes: 3 additions & 11 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ def _validate_linestyle(ls):
'text.color': ['black', validate_color],
'text.usetex': [False, validate_bool],
'text.latex.unicode': [True, validate_bool],
'text.latex.preamble': [[''], validate_stringlist],
'text.latex.preamble': [[], validate_stringlist],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change appears unrelated.

Copy link
Contributor Author

@anntzer anntzer Nov 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because matplotlib.rcsetup.validate_stringlist([""]) == [] (i.e. the default is actually stored as [], not [""]) so the code I deleted complained that the validator was not idempotent here.

'text.latex.preview': [False, validate_bool],
'text.dvipnghack': [None, validate_bool_maybe_none],
'text.hinting': ['auto', validate_hinting],
Expand Down Expand Up @@ -1391,7 +1391,7 @@ def _validate_linestyle(ls):
# use matplotlib rc settings for font configuration
'pgf.rcfonts': [True, validate_bool],
# provide a custom preamble for the latex process
'pgf.preamble': [[''], validate_stringlist],
'pgf.preamble': [[], validate_stringlist],

# write raster image data directly into the svg file
'svg.image_inline': [True, validate_bool],
Expand All @@ -1412,7 +1412,7 @@ def _validate_linestyle(ls):
'agg.path.chunksize': [0, validate_int], # 0 to disable chunking;

# key-mappings (multi-character mappings should be a list/tuple)
'keymap.fullscreen': [('f', 'ctrl+f'), validate_stringlist],
'keymap.fullscreen': [['f', 'ctrl+f'], validate_stringlist],
'keymap.home': [['h', 'r', 'home'], validate_stringlist],
'keymap.back': [['left', 'c', 'backspace'], validate_stringlist],
'keymap.forward': [['right', 'v'], validate_stringlist],
Expand Down Expand Up @@ -1463,11 +1463,3 @@ def _validate_linestyle(ls):
# altogether. For that use `matplotlib.style.use('classic')`.
'_internal.classic_mode': [False, validate_bool]
}


if __name__ == '__main__':
rc = defaultParams
rc['datapath'][0] = '/'
for key in rc:
if not rc[key][1](rc[key][0]) == rc[key][0]:
print("%s: %s != %s" % (key, rc[key][1](rc[key][0]), rc[key][0]))
8 changes: 0 additions & 8 deletions lib/mpl_toolkits/axes_grid1/mpl_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,3 @@ def toggle(self, all=None, ticks=None, ticklabels=None, label=None):
elif _label:
self._axis.label.set_visible(True)
self._axis.set_label_position(self._axis_direction)


if __name__ == '__main__':
import matplotlib.pyplot as plt
fig = plt.figure()
ax = Axes(fig, [0.1, 0.1, 0.8, 0.8])
fig.add_axes(ax)
ax.cla()