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

Added tripcolor triangle-centred colour values.#850

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
efiring merged 7 commits intomatplotlib:masterfromianthomas23:811_tripcolor_centred
Aug 16, 2012

Conversation

ianthomas23
Copy link
Member

Implementation of issue#811.

triplot determines whether color values are specified at triangulation points or triangles based on the length of the color values array, as this is the most intuitive way to do it. The only complication is if there are the same number of points as triangles; in this case you may need to use thecolorpoints kwarg as well. This is a little clumsy, but seems better than forcing the user to always use a kwarg to get the new behaviour.

Existing code is unaffected by the change.

@bfroehle
Copy link
Contributor

I find the kwargcolorpoints confusing. Reading through code and seeingtripcolor(x, y, t, C, colorpoints=False) wouldn't indicate to me a solid shading of each face. I think a clearer interface would betripcolor(x, y, t, facecolors=C).

If you want to allow it to be short circuited totripcolor(x, y, t, C) depending, of course, on the size ofC... well that seems reasonable too.

set to *False*.

*shading* may be 'flat' (the default), 'faceted' or 'gouraud'. If
*shading* is 'flat' or 'faceted' and C values are defined at
Copy link
Member

Choose a reason for hiding this comment

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

Note that elsewhere inpcolormesh, thefaceted option has been deprecated for some time and recently removed in favor of respecting theedgecolors kwarg. Does that make sense to do here as well?

@mdboom
Copy link
Member

This looks like a nice improvement. In addition to my commented aboutfaceted, this should have an example and a unit test.

@ianthomas23
Copy link
MemberAuthor

Apologies for taking so long, but I have now addressed the comments. The changes are, in order of my commits:

  1. Deprecated shading='faceted' and supported the edgecolors kwarg instead, as in pcolormesh.
  2. Removed the confusing colorpoints kwarg and used facecolors instead. I've kept the short-circuited option of not using facecolors if it is clear from the length of C whether it applies to faces or points.
  3. Modified the existing tripcolor example to include a facecolors plot.
  4. Added an image comparison unit test.

Note that the edgecolors kwarg isn't supported for shading='gouraud'. It would be nice to support this, but I cannot see how without changing many files in the backend code. The behaviour is at least consistent with pcolormesh. I've noticed that pcolor doesn't support gouraud shading at all - I presume the conclusion here is that support for gouraud shading is patchy and needs to be reconsidered sometime.

@efiring
Copy link
Member

Thanks very much for the changes.
The merge button is grey, however, so it looks like you need to rebase against master.

@ianthomas23
Copy link
MemberAuthor

I've rebased against master as requested.

is 'flat' and C values are defined at points, the color values
used for each triangle are from the mean C of the triangle's
three points. If *shading* is 'gouraud' then color values must be
defined at triangles. *shading* of 'faceted' is deprecated;
Copy link
Member

Choose a reason for hiding this comment

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

I think you mean "at triangulation points", not "at triangles"; the latter would be the same as using facecolors.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

You are correct; well spotted!

efiring added a commit that referenced this pull requestAug 16, 2012
Added tripcolor triangle-centred colour values.
@efiringefiring merged commit360887a intomatplotlib:masterAug 16, 2012
@efiringefiring mentioned this pull requestAug 16, 2012
tacaswell added a commit to tacaswell/matplotlib that referenced this pull requestJan 10, 2015
Deprecated inmatplotlib#850 /360887aAlso added validation on value of shading to only be in the supportedset.attn@ianthomas23
tacaswell added a commit to tacaswell/matplotlib that referenced this pull requestJan 10, 2015
Deprecated inmatplotlib#850 /360887aAlso added validation on value of shading to only be in the supportedset.attn@ianthomas23
tacaswell added a commit to tacaswell/matplotlib that referenced this pull requestJan 10, 2015
Deprecated inmatplotlib#850 /360887aAlso added validation on value of shading to only be in the supportedset.attn@ianthomas23
tacaswell added a commit to tacaswell/matplotlib that referenced this pull requestJan 11, 2015
Deprecated inmatplotlib#850 /360887aAlso added validation on value of shading to only be in the supportedset.attn@ianthomas23
tacaswell added a commit to tacaswell/matplotlib that referenced this pull requestJan 22, 2015
Deprecated inmatplotlib#850 /360887aAlso added validation on value of shading to only be in the supportedset.attn@ianthomas23
@ianthomas23ianthomas23 deleted the 811_tripcolor_centred branchJuly 8, 2021 18:21
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.

4 participants
@ianthomas23@bfroehle@mdboom@efiring

[8]ページ先頭

©2009-2025 Movatter.jp