Skip to content

Commit

Permalink
give an example usage
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdsharpe committed Sep 15, 2023
1 parent b1bc931 commit 8326b64
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions aerosandbox/tools/pretty_plots/plots/plot_color_by_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
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",
)

0 comments on commit 8326b64

Please sign in to comment.