Skip to content

Commit

Permalink
Remove whitepace from postage-stamp plots
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrost-mo committed Nov 24, 2023
1 parent 1198294 commit 10218d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/CSET/operators/collapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def collapse(
cube: iris.cube.Cube
Cube to collapse and iterate over one dimension
coordinate: str | list[str]
Coordinate(s) to collapse over i.e. 'time', 'longitude', 'latitude',
'model_level_number'. A list of multiple coordinates can be given.
Coordinate(s) to collapse over e.g. 'time', 'longitude', 'latitude',
'model_level_number', 'realization'. A list of multiple coordinates can
be given.
method: str
Type of collapse i.e. method: 'MEAN', 'MAX', 'MIN', 'MEDIAN',
'PERCENTILE' getattr creates iris.analysis.MEAN, etc For PERCENTILE
Expand Down
5 changes: 2 additions & 3 deletions src/CSET/operators/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import iris.cube
import iris.exceptions
import iris.plot as iplt
import matplotlib as mpl
import matplotlib.pyplot as plt
from markdown_it import MarkdownIt

Expand Down Expand Up @@ -164,7 +163,7 @@ def spatial_contour_plot(
# plt.rc('ytick',labelsize=22)

# Filled contour plot of the field.
iplt.contourf(cube, cmap=mpl.cm.magma)
iplt.contourf(cube)

# Add coastlines.
plt.gca().coastlines(resolution="10m")
Expand Down Expand Up @@ -243,7 +242,7 @@ def postage_stamp_contour_plot(
colorbar = plt.colorbar(plot, colorbar_axes, orientation="horizontal")
colorbar.set_label(f"{cube.name()} / {cube.units}")

plt.savefig(filename)
plt.savefig(filename, bbox_inches="tight")
logging.info("Saved contour postage stamp plot to %s", filename)
_make_plot_html_page(filename)
return cube
Expand Down

0 comments on commit 10218d7

Please sign in to comment.