-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
# Custom Axes | ||
A lot of the time you might have your own plots ready to go. | ||
In this case, you can manually invoke ChainConsumer's plotting functions. | ||
Here's an example, noting that there are also `plot_point`, `plot_surface` available | ||
that I haven't explicitly shown. | ||
""" | ||
import matplotlib.pyplot as plt | ||
|
||
from chainconsumer import Chain, Truth, make_sample | ||
from chainconsumer.plotting import plot_contour, plot_truths | ||
|
||
# %% | ||
|
||
df = make_sample(num_dimensions=2, seed=1) | ||
|
||
# Custom plotting code | ||
fig, axes = plt.subplots(ncols=2, figsize=(10, 5)) | ||
axes[0].hist(df["A"], bins=50, color="skyblue", density=True) | ||
|
||
# We can use ChainConsumer to plot a truth value on top of this histogram | ||
truth = Truth(location={"A": 0, "B": 5}, line_style=":") | ||
plot_truths(axes[0], [truth], px="A") | ||
# And also add a contour to the other axis | ||
plot_contour(axes[1], Chain(samples=df, name="Example"), px="A", py="B") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from .contours import plot_cloud, plot_contour, plot_point, plot_surface | ||
from .truth import plot_truths | ||
from .watermark import add_watermark | ||
|
||
__all__ = [ | ||
"add_watermark", | ||
"plot_cloud", | ||
"plot_contour", | ||
"plot_point", | ||
"plot_surface", | ||
"plot_truths", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters