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

FIX: allow single-string color for scatter#12431

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

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedOct 7, 2018
edited
Loading

PR Summary

Closes#12429
Closes#12438

New test fails master, passes this PR, and looks correct:

importmatplotlib.pyplotaspltimportnumpyasnpfig,ax=plt.subplots()ax.scatter(np.arange(10),np.arange(10),c='0.5')plt.show()

scatter

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@jklymakjklymak added this to thev3.0.x milestoneOct 7, 2018
@jklymakjklymak added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelOct 7, 2018
timhoffm
timhoffm previously approved these changesOct 7, 2018
Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

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

Subject to CI passing.

tacaswell
tacaswell previously approved these changesOct 7, 2018
@jklymak
Copy link
MemberAuthor

Travis error is MacOS image tolerance of 0.005 changing fortest_constrained_layout.py::test_colorbar_location. Not sure what changed on macOS to cause this, but it doesn't affect this PR.

@ImportanceOfBeingErnest
Copy link
Member

I wonder if this is the correct fix. The documentation also states

c : color, sequence, or sequence of color, optional, default: 'b'
The marker color. Possible values:

  • A single color format string.
  • A sequence of color specifications of length n.

So for

plt.scatter([0,1],[2,3],c=("0.5", "0.7"))

one would expect two points with different shades of grey. But this is converted to an array of values and shown with the viridis colormap.
Not sure if the documentation is wrong here or the code.

@jklymak
Copy link
MemberAuthor

Well, that didn't work for v2.2.3 either. I don't see any reason that the above shouldn't work the way you say, but its not a regression like#12429 is.

@jklymak
Copy link
MemberAuthor

The newest two commits allow lists like['0.5', '0.7', '0.9', '0.5'] which I agree the docs say we should be able to do.

QuLogic
QuLogic previously requested changesOct 8, 2018
setup.py Outdated
@@ -15,13 +15,12 @@
error = """
Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4.
Beginning with Matplotlib 3.0, Python 3.5 and above is required.

Copy link
Member

Choose a reason for hiding this comment

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

You seem to have some extra changes in this file.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yeah, sorry - will clean up

@jklymakjklymakforce-pushed thefix-single-string-color-scatter branch 5 times, most recently from976ae9f to7e58b82CompareOctober 8, 2018 15:48
@jklymakjklymak dismissed stale reviews fromtacaswell andtimhoffmOctober 8, 2018 16:40

Added more to the PR (list of numeric strings)

@@ -1763,6 +1765,9 @@ def test_scatter_color(self):
([0.5]*3, None), # should emit a warning for user's eyes though
([0.5]*4, None), # NB: no warning as matching size allows mapping
([0.5]*5, "shape"),
# list of strings:
(['0.5', '0.4', '0.6', '0.7'], None),
(['0.5', 'red', '0.6', 'C5'], None),
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add mixtures of string and float to the test? I.e.c=[0.5, '0.5'] andc=['0.5', 0.5].

Not sure what this should result in, but it should either be a defined output or raise an appropriate error. Either way it should be tested.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Good idea. Done!

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Note that it errors, which I think is correct.

@jklymakjklymakforce-pushed thefix-single-string-color-scatter branch from7e58b82 to3cd9b69CompareOctober 8, 2018 17:37
@jklymak
Copy link
MemberAuthor

ping@QuLogic to clear block (setup.py was inadvertently modified)

@QuLogicQuLogic dismissed theirstale reviewOctober 14, 2018 00:06

Extraneous changes removed.

@tacaswelltacaswell merged commitab86e8f intomatplotlib:masterOct 15, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestOct 15, 2018
jklymak added a commit that referenced this pull requestOct 15, 2018
…431-on-v3.0.xBackport PR#12431 on branch v3.0.x (FIX: allow single-string color for scatter)
@jklymakjklymak deleted the fix-single-string-color-scatter branchOctober 22, 2018 17:41
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm approved these changes

@tacaswelltacaswelltacaswell left review comments

@QuLogicQuLogicQuLogic left review comments

@afvincentafvincentAwaiting requested review from afvincent

Assignees
No one assigned
Labels
API: argument checkingRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v3.0.1
Development

Successfully merging this pull request may close these issues.

Scatter doesn't accept a list of strings as color spec. scatter() does not accept gray strings anymore
5 participants
@jklymak@ImportanceOfBeingErnest@tacaswell@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp