Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use sublots in examples#1598

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
ivanov wants to merge5 commits intomatplotlib:masterfromivanov:use-sublots
Closed

Conversation

ivanov
Copy link
Member

this is a rebase of#1462 against master, as discussed on that PR. I believe it is ready to merge

At the recent LBL Software Carpentry Workshop, it was pointed out that there'san inconsistency within our documentation for how to create new figures withsubplots.Indeed, most examples were using the old way, something like:    fig = plt.figure()    ax = plt.subplot(111) # or plt.add_subplot(111)This patch changes a whole bunch of instances like the above to:    fig, ax = plt.subplots()We should strive to have a minimal amount of constants in our code,especially unusual ones like `111`, which only make sense to Matlabrefugees.I have left unchanged examples which were using axes keywords passed tosubplot() and add_subplot(), since those end up transforming things like:    figure()    subplot(111, axisbg='w')to    plt.subplots(subplot_kw=dict(axisbg='w'))which isn't necessarily better.I also did not touch most of the user_interfaces examples, since those did notinvolve using plt, but instead explicitly imported Figure, and used the OOapproach on Figure instances.Also updated instaces where the old "import pylab as p" convention was used touse our standard "import matplotlib.pyplot as plt"I have also updated some, but not all uses of subplot(121) etc, but I'm a bitexhausted after doing all of these.
---------------------------
For the sake of brevity and clarity, most of the :ref:`examples
<examples-index>` now use the newer :func:`~matplotlib.pyplot.subplots`
, which creates a figure and one (or multiple) axes object(s) in one
Copy link
Member

Choose a reason for hiding this comment

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

comma shouldn't be line wrapped here

@mdboom
Copy link
Member

I haven't picked through this with a fine-toothed comb, but +1 in general.

We should try to get this merged before the MEP12 work gets underway -- this is a good start to the example/gallery cleanup that is planned.

@@ -24,13 +24,13 @@ class BlitQT(QObject):
def __init__(self):
QObject.__init__(self, None, "app")

self.ax =p.subplot(111)
self.ax =plt.axes()
Copy link
Member

Choose a reason for hiding this comment

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

fig isn't used anywhere? Is that why you didn't do the usualfig, ax = plt.subplots() here?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

yes, that's right, using axes wassuggested by @pelson here. Though now that this is back against master, I will just change this to the new plt.subplot()

@dmcdougall
Copy link
Member

I fine-toothed it. That took a fair bit of stamina, but I think I've provided some helpful feedback for@ivanov. Let me know if there's anything else I can do. Other than that I think this is good to go.

@mdboom Was there a consensus on whether this should also go into v1.2.x?

@ivanov
Copy link
MemberAuthor

@dmcdougall I think thefinal word was that this should not go intov1.2.x, which is why I closed that PR. Thanks for your feedback, I'll just add a commit addressing this round of reviews shortly

@dmcdougall
Copy link
Member

Surely there is no wayb34b6b7 caused that Python 3.2 Travis failure...

@ivanov
Copy link
MemberAuthor

yeah, the false positive rate for Travis is pretty frustrating :\

@mdboom
Copy link
Member

Sorry this got dropped. I'm worried that it may be really difficult to merge with#1623 which moves around many of the examples. Maybe this could be rebased off of#1623 and merged in there. In any event, this will need some coordination between at least@ivanov,@tonysyu and myself.

@pelson
Copy link
Member

Ouch. I agree with@mdboom on this one - this is very much desirable, but getting this into a position where it plays nicely with@tonysyu changes (and any other changes which have happened since this PR was created) could be a nightmare. I think smaller PRs are the way forward here.

@mdboom
Copy link
Member

Sometimesgit really shines. It actually was able to do this rebase fairly smoothly and tracked the many moved files just fine. I'm put up a rebased version of this PR in#2043 so@ivanov's hard work doesn't go to waste. I can't guarantee it's complete (i.e. using subplots everywhere), but it's a definite improvement.

@efiring
Copy link
Member

I'm closing this because it is replaced by#2043.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v1.3.x
Development

Successfully merging this pull request may close these issues.

5 participants
@ivanov@mdboom@dmcdougall@pelson@efiring

[8]ページ先頭

©2009-2025 Movatter.jp