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

Text wrapping & better handling of kwargs in pyplot#942

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

Merged
pelson merged 1 commit intomatplotlib:masterfrompelson:pyplot_wrapper_tidy
Jun 15, 2012

Conversation

pelson
Copy link
Member

As mentioned in#928, I have some improvements to pyplot which required an improved workflow for generating the pyplot script in the first place. These are those changes.

Firstly, I have added text wrapping in the pyplot module such that no autogenerated line is longer than 80 characters.

Secondly, I have fixed a bug where keyword passing is miss-handled (keywords were previously being passed as positional arguments), which is best demonstrated by the following example:

import matplotlib.pyplot as pltimport matplotlib.axes as maxesimport matplotlib.projections as mprojclass MyAxes(maxes.Axes):    name = 'myaxes'    def imshow(self, *args, **kwargs):        kwargs.setdefault('alpha', 0.5)        maxes.Axes.imshow(self, *args, **kwargs)mproj.register_projection(MyAxes)plt.gca(projection='myaxes')plt.imshow('my_img.png')

Resulting in the following error:

TypeError: imshow() got multiple values for keyword argument 'alpha'

@WeatherGod
Copy link
Member

Ooooh, I gotta test this one out. It might solve a problem for me in mplot3d.

@WeatherGod
Copy link
Member

Hmmm, it does not solve the problem I have for mplot3d's scatter() (I get an error message saying that multiple values for 'zs' is given for the invocation as plt.scatter(x, y, zs=z), and I get an error saying that multiple values for 'c' is given for the invocation as plt.scatter(x, y, z). Note that I don't expect the latter to work.

@pelson
Copy link
MemberAuthor

Are you sure? The following code works for me on this branch, but not for me on master:

import numpy as npfrom mpl_toolkits.mplot3d import Axes3Dimport matplotlib.pyplot as pltax = plt.axes(projection='3d')n = 3xs = np.random.randint(23, 32, n)ys = np.random.randint(0, 100, n)zs = np.random.randint(0, 10, n)plt.scatter(xs, ys, zs=zs)plt.show()

@WeatherGod
Copy link
Member

Huh, must have used the wrong branch or maybe the pyplot.py file didn't rebuild properly? It now works from a clean install. Neat!

We probably should make sure that all tests pass and that the examples in the documentation didn't break.

@pelson
Copy link
MemberAuthor

We probably should make sure that all tests pass and that the examples in the documentation didn't break.

Should have said, I have done a test run and full documentation build before opening the PR.

Seems like there are no concerns so I will merge in ~18 hours (tomorrow morning for me).

pelson pushed a commit that referenced this pull requestJun 15, 2012
Text wrapping & better handling of kwargs in pyplot
@pelsonpelson merged commit70c2cbb intomatplotlib:masterJun 15, 2012
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
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@pelson@WeatherGod

[8]ページ先頭

©2009-2025 Movatter.jp