handle validate_legend_loc deprecation in matplotlib >=3.3 by SarthakJariwala · Pull Request #33 · ppinard/matplotlib-scalebar (original) (raw)

validate_legend_loc is deprecated in matplotlib 3.3 (to be removed in 3.5) and leaves annoying warnings.

However, the warnings only show up if you update the rcParams using : matplotlib.rcParams.update({"scalebar.location": "lower right}). They don't show up if you do : defaultParams.update({"scalebar.location": "lower right}) and that's likely why it doesn't show up while running tests in matplotlib_scalebar. (Found this out because I kept getting annoying warnings like this while building documentation for my package)

(not sure if not showing deprecation warning in defaultParams.update counts as a bug on matplotlib's end)

Anyways, this PR should fix the deprecation warning. My current take is to simply take the validate_legend_loc implementation from matplotlib. Maybe there's a better way...but this works