Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
Add warning for mixing AnchoredText with bad kwarg
Mixing 'ha' or 'va' with AnchoredText produces bad output, so add a warning in
this case.
  • Loading branch information
dmcdougall committed Jul 1, 2013
commit bff7ef550b693790fe11a13109d8513fabebb066
7 changes: 7 additions & 0 deletions lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


from __future__ import print_function
import warnings
import matplotlib.transforms as mtransforms
import matplotlib.artist as martist
import matplotlib.text as mtext
Expand Down Expand Up @@ -1098,6 +1099,12 @@ def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs):
other keyword parameters of AnchoredOffsetbox are also allowed.
"""

propkeys = prop.keys()
badkwargs = ('ha', 'horizontalalignment', 'va', 'verticalalignment')
if set(badkwargs) & set(propkeys):
warnings.warn("Mixing horizontalalignment or verticalalignment "
"with AnchoredText is not supported.")

self.txt = TextArea(s, textprops=prop,
minimumdescent=False)
fp = self.txt._text.get_fontproperties()
Expand Down