GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Named Figures feature: plot('today') by butterw · Pull Request #147 · matplotlib/matplotlib

Conversation

@butterw

@butterw butterw commented Jun 17, 2011

Copy link
Copy Markdown

Continued from issue #100 (my repo was messed up).

Hopefully this time it works...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
butterw
Named figures feature: plt.figure("today")
2910319
@ddale

ddale commented Jun 18, 2011

Copy link
Copy Markdown
Contributor

I don't think the figure name should appear in the canvas. Naming a figure is not the same thing as giving a figure or axes a title.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@butterw

butterw commented Jun 19, 2011

Copy link
Copy Markdown
Author

This is done only in the image comparison test.
The aim of that test is to check that plotting works ok with named figures.
To ensure plotting is done on the correct figure, it is useful to draw the
figure name on the output.

Le , ddale
[email protected]
a crit :

I don't think the figure name should appear in the canvas. Naming a
figure is not the same thing as giving a figure or axes a title.

Reply to this email directly or view it on GitHub:

#147 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

leejjoon
leejjoon reviewed Jun 19, 2011
View reviewed changes
Comment thread lib/matplotlib/pyplot.py Outdated

@leejjoon leejjoon Jun 19, 2011

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I don't think the logic here is correct. There is no guarantee that the index of figLabel corresponds to the figure number.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@butterw butterw Jun 19, 2011

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

should be:
num = allLabels.index(figLabel)
num = allnums[num]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@leejjoon

leejjoon commented Jun 19, 2011

Copy link
Copy Markdown
Contributor

To elaborate my comment on the source code, here is an example

import matplotlib.pyplot as plt
f1 = plt.figure("1")
f2 = plt.figure("2")
f3 = plt.figure("3")
   
plt.close("1")
from matplotlib.pyplot import _pylab_helpers
figManagers = _pylab_helpers.Gcf.get_all_fig_managers()
print [m.num for m in figManagers]

And it prints out

[2, 3]

We may use a dictionary that maps labels to figure numbers.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@butterw

butterw commented Jun 19, 2011

Copy link
Copy Markdown
Author

There was a mistake in the code (corrected below).

I don't think Dictionnary access is possible because labels are not guaranteed to be unique.

correct version:
if figLabel not in allLabels:
if len(allLabels):
num = max(allnums) + 1
else:
num = 1
else:
num = allLabels.index(figLabel)
num = allnums[num]

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@leejjoon

leejjoon commented Jun 20, 2011

Copy link
Copy Markdown
Contributor

Please push your changes into your repo.

Eric commented on the issue of using "all" as a figure name (#99 (comment)). And I think it is better to explicitly prevent it from being used.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

butterw
named figures bugfix
ca42eaa
@butterw

butterw commented Jun 20, 2011

Copy link
Copy Markdown
Author

What is the desired behavior when a new figure('all') is created ?

  1. create figure
  2. create figure + warn
  3. do not create figure + warn

I think 'all' is a reasonable value for creating/selecting a named figure. It's only if close('all') is called that there is a possible issue. Therefore, I would go with solution 2).

the warning message could be the following:
warning: using figure name 'all' is not recommended because calling close('all') will close all existing figures instead of just figure 'all'. figure('all') was created.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@leejjoon

leejjoon commented Jun 20, 2011

Copy link
Copy Markdown
Contributor

Okay. With a reasonable warning message, option 2 should be good.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

butterw
warning on figure('all') creation
4d45160
@butterw

butterw commented Jul 14, 2011

Copy link
Copy Markdown
Author

The feature is fully implemented and ready for pull.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

efiring added a commit that referenced this pull request Aug 20, 2011
@efiring
Merge pull request #147 from butterw/master
94cf18d
Named Figures feature: plot('today')
@efiring
efiring merged commit 94cf18d into matplotlib:master Aug 20, 2011
@efiring

efiring commented Aug 20, 2011

Copy link
Copy Markdown
Member

This seems to me like a useful and logical feature, and a bit of testing turned up no surprises, so I saw no reason not to merge it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@richbwood richbwood mentioned this pull request Dec 19, 2012
test_pcolormesh hangs #1609
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@butterw @ddale @leejjoon @efiring
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.