From 8326b64d96dacd1a19222df341bae8e9baba8a75 Mon Sep 17 00:00:00 2001 From: Peter Sharpe Date: Fri, 15 Sep 2023 15:36:09 -0400 Subject: [PATCH] give an example usage --- .../pretty_plots/plots/plot_color_by_value.py | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/aerosandbox/tools/pretty_plots/plots/plot_color_by_value.py b/aerosandbox/tools/pretty_plots/plots/plot_color_by_value.py index 2442173d..bbe473b9 100644 --- a/aerosandbox/tools/pretty_plots/plots/plot_color_by_value.py +++ b/aerosandbox/tools/pretty_plots/plots/plot_color_by_value.py @@ -106,9 +106,21 @@ def plot_color_by_value( return lines, sm, cbar if __name__ == '__main__': - plt.figure() - x = np.linspace(0, 10, 100) - y = np.sin(x) - c = x - plot_color_by_value(x, y, c=c, colorbar=True) - plt.show() \ No newline at end of file + import matplotlib.pyplot as plt + import aerosandbox.tools.pretty_plots as p + + fig, ax = plt.subplots() + x = np.linspace(-1, 1, 500) + y = np.sin(10 * x) + c = np.sin((10 * x) ** 2) + plot_color_by_value( + x, y, + c=c, + clim=(-1, 1), + colorbar=True, colorbar_label="Colorbar Label" + ) + p.show_plot( + "Title", + "X Axis", + "Y Axis", + ) \ No newline at end of file