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

feat(plot): add functions to plot distributions of particle data #4

Merged
merged 2 commits into from
Feb 17, 2025

Conversation

mtrocadomoreira
Copy link
Owner

Add ozzy.plot.hist and ozzy.plot.hist_proj to easily plot density distributions (histograms) of particle data, taking advantage of the seaborn functions seaborn.histplot and seaborn.jointplot.

Previously it would have been necessary to bin the data first, and then plot, e.g.:

import ozzy as oz
import ozzy.plot as oplt
# A particle data Dataset
ds = oz.Dataset(..., pic_data_type="part")
ds_ps = ds.ozzy.get_phase_space(["p2", "x2"])
ds_ps["rho"].plot()

While now the following code is enough:

import ozzy as oz
import ozzy.plot as oplt
ds = oz.Dataset(..., pic_data_type='part')
oplt.hist(ds, x="x2", y="p2")

Add `ozzy.plot.hist` and `ozzy.plot.hist_proj` to easily plot density distributions (histograms) of particle data, taking advantage of the seaborn functions [`seaborn.histplot`](https://seaborn.pydata.org/generated/seaborn.histplot.html) and [`seaborn.jointplot`](https://seaborn.pydata.org/generated/seaborn.jointplot.html).

Previously it would have been necessary to bin the data first, and then plot, e.g.:
```python
import ozzy as oz
import ozzy.plot as oplt
# A particle data Dataset
ds = oz.Dataset(..., pic_data_type="part")
ds_ps = ds.ozzy.get_phase_space(["p2", "x2"])
ds_ps["rho"].plot()
```
While now the following code is enough:
```python
import ozzy as oz
import ozzy.plot as oplt
ds = oz.Dataset(..., pic_data_type='part')
oplt.hist(ds, x="x2", y="p2")
```
@mtrocadomoreira mtrocadomoreira merged commit 06d0869 into main Feb 17, 2025
2 checks passed
@mtrocadomoreira mtrocadomoreira deleted the histplot branch February 17, 2025 16:12
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.

1 participant