Skip to content

Integrate optional plotting capabilities into ashist()#636

Open
willcollins10 wants to merge 3 commits into
xgi-org:devfrom
willcollins10:add-plotting-capabilities
Open

Integrate optional plotting capabilities into ashist()#636
willcollins10 wants to merge 3 commits into
xgi-org:devfrom
willcollins10:add-plotting-capabilities

Conversation

@willcollins10

Copy link
Copy Markdown
Contributor

Description

This PR integrates optional plotting capabilities directly into the ashist() function. Users can now generate plots ('bar', 'line', or 'step') by setting the plot parameter to True and customize plot appearance using plot_kwargs.

Changes Made

  • Added plot and plot_kwargs parameters to the ashist() function.
  • Implemented plotting logic using matplotlib.pyplot based on the specified plot type.
  • Automatically sets axis labels and plot titles using metadata attributes.
  • Adds vertical lines for bin edges if bin_edges is True.

Testing

  • Added unit tests to validate different plot types and plot_kwargs.
  • Ensured that invalid plot types raise appropriate errors.
  • Verified interaction with existing parameters like density and bin_edges.

Related Issues

Closes #<606>

@willcollins10 willcollins10 marked this pull request as ready for review December 8, 2024 20:18
@nwlandry

nwlandry commented Dec 9, 2024

Copy link
Copy Markdown
Collaborator

@willcollins10 --- thanks for the PR! I will try to take a look this afternoon!

@nwlandry

nwlandry commented Dec 9, 2024

Copy link
Copy Markdown
Collaborator

@willcollins10 --- side note, the tests fail because the example you added in the docstring never defines H.

@nwlandry nwlandry left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall looks awesome! Three main comments: (1) move the plotting contents to a helper function and (2) add the ability to plot a scatterplot, and (3) fix the docstring so that the doctests pass. Thanks for the contribution!

Comment thread xgi/stats/__init__.py Outdated
Comment thread xgi/stats/__init__.py
Comment thread xgi/stats/__init__.py Outdated
Comment thread xgi/stats/__init__.py Outdated
Comment thread xgi/stats/__init__.py Outdated
@kaiser-dan kaiser-dan added improve Make an existing feature better viz labels Feb 26, 2026
@kaiser-dan kaiser-dan changed the base branch from main to dev February 26, 2026 15:43
@maximelucas maximelucas force-pushed the add-plotting-capabilities branch from 3cab05e to 1015af0 Compare June 1, 2026 12:42
…octest

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@maximelucas maximelucas force-pushed the add-plotting-capabilities branch from cf6305a to b0e955d Compare June 1, 2026 12:52
@maximelucas

Copy link
Copy Markdown
Collaborator

@nwlandry I think I addressed your comments, if you're happy we can close.

@maximelucas maximelucas linked an issue Jun 1, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improve Make an existing feature better viz

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite the stats tohist() method

4 participants