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

[WIP] Categorical Color Mapping#6934

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
story645 wants to merge5 commits intomatplotlib:masterfromstory645:color

Conversation

story645
Copy link
Member

@story645story645 commentedAug 10, 2016
edited
Loading

Start of a PR to simplify creating colormaps for categorical data such that (key, value) pairs can be used - and then reused in other functions. Currently using ListedColormap alone requires one to mentally sort the data and then list colors accordingly, as does using ListedColormap+BoundaryNorm, and the latter also requires an upper boundary that is unintuitive for data that isn't interval. This aims to somewhat address#6214 &#6802

This is just a teeny wrapper over colors.ListedColormap and colors.BoundaryNorm (which is probably the wrong thing to do and I should write a CategoryNorm to do 1 int to 1 color mapping) in the style ofcolors.from_levels_and_colors that allows users to do this:

importnumpyasnpimportmatplotlib.pyplotaspltimportmatplotlib.categoryascatdata=np.array([[205,101,302], [205,302,101], [302,205,101]])codings= {205:"red",101:"blue",302:"green"}cmap,norm=cat.colors_from_categories(codings)sm=plt.imshow(a,cmap=cmap,norm=norm)

index

This is all tentative, but next steps are:

  • write CategoryNorm
  • extend categorical support to imshow
  • extend categorical to scatter markers
  • get this hooked into legend since that makes more sense than colorbar anyway
  • sort out the colorbar

Also, this PR is dependent on#6920 since it uses py.test and branches off of#6889 because it may need those features.

More notes:

Need to change when imshow does it's casting, currently too early
Makes use of StrCategoricalConverter
Conversion gets stashed in Norm, which seems to be the place to do unit stuff on scaler mappables since it's the level at which value mapping happens anyway...

@tacaswelltacaswell modified the milestone:2.1 (next point release)Oct 11, 2016
@tacaswelltacaswell modified the milestones:2.1 (next point release),2.2 (next next feature release)Aug 29, 2017
@story645story645 modified the milestones:v2.2,v3.0Feb 6, 2018
@story645
Copy link
MemberAuthor

closing in favor of a norm based approach + specialized legend for discrete norms discussed in#7383

@story645story645 deleted the color branchMay 9, 2018 20:21
@QuLogicQuLogic removed this from thev3.0 milestoneMay 9, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@story645@tacaswell@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp