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

triheatmap #265

Merged
merged 6 commits into from
Oct 3, 2024
Merged

triheatmap #265

merged 6 commits into from
Oct 3, 2024

Conversation

juliettelavoie
Copy link
Contributor

@juliettelavoie juliettelavoie commented Oct 2, 2024

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • (If applicable) Documentation has been added / updated (for bug fixes / features).
  • (If applicable) Tests have been added.
  • CHANGELOG.rst has been updated (with summary of main changes).
    • Link to issue (:issue:number) and pull request (:pull:number) has been added.

What kind of change does this PR introduce?

  • New function to do triangle heatmap

Does this PR introduce a breaking change?

no

Other information:

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added the docs label Oct 2, 2024
@Zeitsperre
Copy link
Contributor

Ignore the finish failure. It's being fixed upstream.

@juliettelavoie
Copy link
Contributor Author

I am thinking about this more and I am not sur if the list of plot_kw and cbar_kw is really in the figanos style. I am wondering if it should be a dict instead. In that case, should data be also a dict with 2 or 4 element (one ds per triangle type) ? What makes the most sense to you 1 3D dataset or 2/4 2D datasets?

Copy link
Collaborator

@sarahclaude sarahclaude left a comment

Choose a reason for hiding this comment

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

Could vmin and vmax be automatically added by finding min/max values from da when user don't add them to plot_kw?

Thanks Juliette, looks great!


def triheatmap(
data: xr.DataArray | xr.Dataset,
dim: str,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could use hue instead of dim to be similar to xarray plot: https://docs.xarray.dev/en/stable/user-guide/plotting.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well hue means color, I'm not sure it's adapted here has the triangles could be the same colors. how about tri_dim or triangle ?

----------
data : DataArray or Dataset
Input data do plot.
ax : matplotlib axis, optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing 'dim'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oups!

f"The length of the dimensiondim ({dim},{len(d)}) should be either 2 or 4. It represents the number of triangles."
)

plt.xlabel(other_dims[0])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could xlabel or ylabel also be linked to use_attrs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes!

@juliettelavoie juliettelavoie merged commit 7126686 into main Oct 3, 2024
15 checks passed
@juliettelavoie juliettelavoie deleted the triheatmap branch October 3, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants