Skip to content

Commit

Permalink
Infrastructure added for optional contours. Defaults to not plotting.
Browse files Browse the repository at this point in the history
  • Loading branch information
misi9170 committed Oct 20, 2023
1 parent 05b900c commit 89543b5
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions floris/tools/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ def add_turbine_id_labels(fi: FlorisInterface, ax: plt.Axes, **kwargs):
)


def line_contour_cut_plane(cut_plane, ax=None, levels=None, colors=None, **kwargs):
def line_contour_cut_plane(
cut_plane,
ax=None,
levels=None,
colors=None,
label_contours=False,
**kwargs):
"""
Visualize a cut_plane as a line contour plot.
Expand All @@ -164,6 +170,8 @@ def line_contour_cut_plane(cut_plane, ax=None, levels=None, colors=None, **kwarg
Defaults to None.
colors (list, optional): Strings of color specification info.
Defaults to None.
label_contours (Boolean, optional): Flag to include a numerical contour labels
on the plot. Defaults to False.
**kwargs: Additional parameters to pass to `ax.contour`.
"""

Expand All @@ -183,7 +191,8 @@ def line_contour_cut_plane(cut_plane, ax=None, levels=None, colors=None, **kwarg
**kwargs,
)

ax.clabel(contours, contours.levels, inline=True, fontsize=10, colors="black")
if label_contours:
ax.clabel(contours, contours.levels, inline=True, fontsize=10, colors="black")

# Make equal axis
ax.set_aspect("equal")
Expand All @@ -199,6 +208,7 @@ def visualize_cut_plane(
levels=None,
clevels=None,
color_bar=False,
label_contours=False,
title="",
**kwargs
):
Expand All @@ -224,6 +234,8 @@ def visualize_cut_plane(
Defaults to None.
color_bar (Boolean, optional): Flag to include a color bar on the plot.
Defaults to False.
label_contours (Boolean, optional): Flag to include a numerical contour labels
on the plot. Defaults to False.
title (str, optional): User-supplied title for the plot. Defaults to "".
**kwargs: Additional parameters to pass to line contour plot.
Expand Down Expand Up @@ -275,6 +287,7 @@ def visualize_cut_plane(
ax=ax,
levels=levels,
colors="b",
label_contours=label_contours,
linewidths=0.8,
alpha=0.3,
**kwargs
Expand Down Expand Up @@ -307,6 +320,7 @@ def visualize_heterogeneous_cut_plane(
levels=None,
clevels=None,
color_bar=False,
label_contours=False,
title="",
plot_het_bounds=True,
**kwargs
Expand Down Expand Up @@ -334,6 +348,8 @@ def visualize_heterogeneous_cut_plane(
Defaults to None.
color_bar (Boolean, optional): Flag to include a color bar on the plot.
Defaults to False.
label_contours (Boolean, optional): Flag to include a numerical contour labels
on the plot. Defaults to False.
title (str, optional): User-supplied title for the plot. Defaults to "".
plot_het_bonds (boolean, optional): Flag to include the user-defined bounds of the
heterogeneous wind speed area. Defaults to True.
Expand Down Expand Up @@ -386,6 +402,7 @@ def visualize_heterogeneous_cut_plane(
ax=ax,
levels=levels,
colors="b",
label_contours=label_contours,
linewidths=0.8,
alpha=0.3,
**kwargs
Expand Down

0 comments on commit 89543b5

Please sign in to comment.