@@ -448,11 +448,6 @@ def _get_plot_resolution() -> int:
448448 return get_recipe_metadata ().get ("plot_resolution" , 100 )
449449
450450
451- def _get_histogram_method () -> str :
452- """Get method to use when computing histograms."""
453- return get_recipe_metadata ().get ("histogram_method" , "density" ).lower ()
454-
455-
456451def _plot_and_save_spatial_plot (
457452 cube : iris .cube .Cube ,
458453 filename : str ,
@@ -1167,7 +1162,7 @@ def _plot_and_save_histogram_series(
11671162 title : str ,
11681163 vmin : float ,
11691164 vmax : float ,
1170- ** kwargs ,
1165+ histogram_method : str ,
11711166):
11721167 """Plot and save a histogram series.
11731168
@@ -1183,6 +1178,8 @@ def _plot_and_save_histogram_series(
11831178 minimum for colorbar
11841179 vmax: float
11851180 maximum for colorbar
1181+ histogram_method: str
1182+ Histogram method to use i.e. frequency, normalised_frequency or density.
11861183 """
11871184 fig = plt .figure (figsize = (10 , 10 ), facecolor = "w" , edgecolor = "k" )
11881185 ax = plt .gca ()
@@ -1230,7 +1227,7 @@ def _plot_and_save_histogram_series(
12301227 # Plot the histogram.x, y = np.histogram(cube_data_1d, bins=bins, density=density)
12311228 y = _plot_histogram (
12321229 cube_data_1d ,
1233- method = _get_histogram_method () ,
1230+ method = histogram_method ,
12341231 title = title ,
12351232 units = cube .units ,
12361233 bins = bins ,
@@ -1267,7 +1264,7 @@ def _plot_and_save_postage_stamp_histogram_series(
12671264 stamp_coordinate : str ,
12681265 vmin : float ,
12691266 vmax : float ,
1270- ** kwargs ,
1267+ histogram_method : str ,
12711268):
12721269 """Plot and save postage (ensemble members) stamps for a histogram series.
12731270
@@ -1285,6 +1282,9 @@ def _plot_and_save_postage_stamp_histogram_series(
12851282 minimum for pdf x-axis
12861283 vmax: float
12871284 maximum for pdf x-axis
1285+ histogram_method: str
1286+ Histogram method to use i.e. frequency, normalised_frequency or density.
1287+
12881288 """
12891289 # Use the smallest square grid that will fit the members.
12901290 grid_size = int (math .ceil (math .sqrt (len (cube .coord (stamp_coordinate ).points ))))
@@ -1320,7 +1320,7 @@ def _plot_and_save_postage_stamps_in_single_plot_histogram_series(
13201320 stamp_coordinate : str ,
13211321 vmin : float ,
13221322 vmax : float ,
1323- ** kwargs ,
1323+ histogram_method : str ,
13241324):
13251325 fig , ax = plt .subplots (figsize = (10 , 10 ), facecolor = "w" , edgecolor = "k" )
13261326 ax .set_title (title , fontsize = 16 )
@@ -2004,7 +2004,7 @@ def scatter_plot(
20042004def vector_plot (
20052005 cube_u : iris .cube .Cube ,
20062006 cube_v : iris .cube .Cube ,
2007- filename : str = None ,
2007+ filename : str | None = None ,
20082008 sequence_coordinate : str = "time" ,
20092009 ** kwargs ,
20102010) -> iris .cube .CubeList :
@@ -2059,10 +2059,11 @@ def vector_plot(
20592059
20602060def plot_histogram_series (
20612061 cubes : iris .cube .Cube | iris .cube .CubeList ,
2062- filename : str = None ,
2062+ filename : str | None = None ,
20632063 sequence_coordinate : str = "time" ,
20642064 stamp_coordinate : str = "realization" ,
20652065 single_plot : bool = False ,
2066+ histogram_method : str = "frequency" ,
20662067 ** kwargs ,
20672068) -> iris .cube .Cube | iris .cube .CubeList :
20682069 """Plot a histogram plot for each vertical level provided.
@@ -2095,6 +2096,8 @@ def plot_histogram_series(
20952096 If True, all postage stamp plots will be plotted in a single plot. If
20962097 False, each postage stamp plot will be plotted separately. Is only valid
20972098 if stamp_coordinate exists and has more than a single point.
2099+ histogram_method: str
2100+ Histogram method to use i.e. frequency, normalised_frequency or density.
20982101
20992102 Returns
21002103 -------
@@ -2227,6 +2230,7 @@ def plot_histogram_series(
22272230 title = title ,
22282231 vmin = vmin ,
22292232 vmax = vmax ,
2233+ histogram_method = histogram_method ,
22302234 )
22312235 plot_index .append (plot_filename )
22322236
0 commit comments