Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyPlot: fix label position and annotate color bar #39

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

pjaap
Copy link
Member

@pjaap pjaap commented Nov 18, 2024

This PR does the following in gridplot with PyPlot

Before:
image

After:
image

@j-fu
Copy link
Member

j-fu commented Nov 18, 2024

Cool. But the idea is that cell regions are in pastel colors and boundary regions in bright.
Also, not sure which are more important to have if there is only one colorbar possible. I think it's the boundary regions. Not sure if we should go down the rabbit hole and add more options...

@pjaap
Copy link
Member Author

pjaap commented Nov 18, 2024

True, the colors are wrong. That is hopefully not so difficult to fix. And that thy the annotation "boundary regions" is so important :)

@pjaap pjaap force-pushed the feature/pyplot-correct-colobar branch from f697111 to 55d0180 Compare November 18, 2024 15:43
@pjaap pjaap marked this pull request as draft November 18, 2024 15:46
@pjaap
Copy link
Member Author

pjaap commented Nov 18, 2024

Sigh. It does not seem as simple as it looks. The problem here is that originally, we create a tripcolorplot that shows the colored triangulation and then add a colorbar that describes the plot. However, we do not want to describe the plot, but only the boundary colors.

I uploaed a HACK!! where we simply use tripcolor twice to overwrite the plot with pastel colors but show the colorbar of the pastel colors. I am not an expert on PyPlot, to be honest :)

But the result is a desired:
image

@j-fu Do you know how to make this elegantly in the code?

@j-fu
Copy link
Member

j-fu commented Nov 18, 2024

Not really. May be it works as well if you plot just one triangle for the first plot.
python plotting is relatively slow, and the slowdown from plotting twice possibly is nontrivial.

@pjaap pjaap force-pushed the feature/pyplot-correct-colobar branch from 55d0180 to 702fbae Compare November 27, 2024 12:26
@pjaap
Copy link
Member Author

pjaap commented Nov 27, 2024

Rebased.

I changed the dummy plot to plot only one triangle (I extract the first 3 coordinates). Results are as shown before.

@pjaap pjaap marked this pull request as ready for review November 27, 2024 12:28
@jpthiele jpthiele merged commit 86a488e into main Nov 27, 2024
10 checks passed
@j-fu
Copy link
Member

j-fu commented Nov 27, 2024

Well, it crashes for me. Can you try what I described:

https://wias-pdelib.github.io/GridVisualize.jl/stable/contributing/

on your computer ?

(it may make sense to check the pyplot case along with CairoMakie and PlutoVista in the CI).

@j-fu j-fu mentioned this pull request Nov 27, 2024
@pjaap
Copy link
Member Author

pjaap commented Nov 27, 2024

Thanks for the pointer, I didn't know that one. I'll add some code to the unit tests that catch the failure.

@pjaap pjaap mentioned this pull request Nov 28, 2024
@pjaap pjaap deleted the feature/pyplot-correct-colobar branch January 2, 2025 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants