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

Skip to content

removed deprecated methods from the axes module. #1568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 16, 2013
Merged

removed deprecated methods from the axes module. #1568

merged 4 commits into from
Jan 16, 2013

Conversation

NelleV
Copy link
Member

@NelleV NelleV commented Dec 7, 2012

This PR not only removes deprecated methods, but also add deprecated warnings for methods that were said as being deprecated, but no warning had ever been added.

All the tests pass.

Thanks,
N

@NelleV
Copy link
Member Author

NelleV commented Dec 7, 2012

Unlike what I said, travis-ci tells me the tests don't pass... i'll have a closer look.

@efiring
Copy link
Member

efiring commented Dec 7, 2012

I think that you will also want to use the new MatplotlibDeprecationWarning; I'm not sure whether it has been merged yet, but it is the way to go.

@NelleV
Copy link
Member Author

NelleV commented Dec 7, 2012

It has not been merged yet. I'll update the PR once it is.

@@ -6137,6 +6076,9 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
else:
colors = mcolors.colorConverter.to_rgba_array(c, alpha)

# FIXME: faceted is deprecated but no warning is set when faceted is
# manually set to True.
# Moreover, is edgecolors 'none' and None different ?
Copy link
Member

Choose a reason for hiding this comment

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

Yes, None means use the rcParams['patch.edgecolor'], but "none" means "don't color the edges at all".

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, good to now (I could have looked it up).

One way to fix the deprecation warning problem I mention just above would be to change the default value of faceted to spot when it is manually set to True, and raise the warning.
I'm not sure it is the best way to go, but that's the only thing my (very tired) brain is coming up with right now...

Copy link
Member

Choose a reason for hiding this comment

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

@NelleV I think the thing to do here, after you have had a good rest, is to remove faceted from the listed kwargs. Then

faceted = kwargs.pop('faceted', None)
if faceted is not None:
    # raise the deprecation warning...
    # and set edgecolors as is already being done based on the value of faceted...

Copy link
Member Author

Choose a reason for hiding this comment

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

It's done !

@NelleV
Copy link
Member Author

NelleV commented Dec 8, 2012

I'm now using the new matplotlib deprecation warning.

if faceted is not None:
raise MDeprecation("The faceted option is deprecated. "
"Please use edgecolor instead. Will "
"be remove in 1.4")
Copy link
Member

Choose a reason for hiding this comment

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

By raising here, this functionality is eliminated, there's no way for the code path to continue. So either keeps this as a warning, or raise with just "The faceted option is deprecated. Please use edgecolor instead."

@ivanov
Copy link
Member

ivanov commented Dec 14, 2012

I left a few comments inline, but wanted to add that since this now uses MatplotlibDeprecationWarning which currently lives in #1597, this PR should be merged after that one.

@NelleV
Copy link
Member Author

NelleV commented Dec 30, 2012

I've updated this patch with the new interface.

@NelleV
Copy link
Member Author

NelleV commented Jan 7, 2013

I think this is ready to be merged.

@@ -7307,6 +7251,9 @@ def pcolor(self, *args, **kwargs):
cmap = kwargs.pop('cmap', None)
vmin = kwargs.pop('vmin', None)
vmax = kwargs.pop('vmax', None)
if 'shading' in kwargs:
raise DeprecationWarning("Use edgecolors instead of shading. "
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be a mplDeprecation?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch. I've fixed it.

@NelleV
Copy link
Member Author

NelleV commented Jan 16, 2013

@dmcdougall Maybe you can have a look at this PR ? It should be quite staightforward and ready for merge.

@dmcdougall
Copy link
Member

@NelleV Code style looks good, but Travis is legitimately failing. I will run the tests locally and try to help you through fixing the errors.

@ghost ghost assigned dmcdougall Jan 16, 2013
if faceted:
edgecolors = None
else:
edgecolors = 'none'
Copy link
Member

Choose a reason for hiding this comment

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

In the scatter test, this code never gets executed and edgecolors doesn't get set.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've fixed the problem. I think there was a bug before, as edgecolors was always set from the argument faceted, instead of being fetched from the kwargs.

I also think we need to consider moving it from kwargs to a named argument. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I think that, to be consistent with the other pyplot functions, we should leave it as a kwarg and perhaps formulate an MEP to overhaul the kwargs if there is a consensus for that.

@dmcdougall
Copy link
Member

Ok, since that edgecolors fix, the tests pass on 2.7 and 3.2 and we get dud failures for 2.6 and 3.1. I'm going to merge this.

Thanks @NelleV.

dmcdougall added a commit that referenced this pull request Jan 16, 2013
removed deprecated methods from the axes module.
@dmcdougall dmcdougall merged commit 8943757 into matplotlib:master Jan 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants