class_docstr: All parameters computed for the plotnine tight layout engine
class_docstr_tok: ["All","parameters","computed","for","the","plotnine","tight","layout","engine"]
docstr: Reduce the height of axes to get the aspect ratio
docstr_tok: ["Reduce","the","height","of","axes","to","get","the","aspect","ratio"]
code: def _reduce_height(
      self, facet: Facet, ratio: float, parts: WHSpaceParts
  ) -> TightParams:
      """
      Reduce the height of axes to get the aspect ratio
      """
      params = deepcopy(self)
      spaces = params.spaces
      grid = params.grid
  
      # New height w.r.t figure height
      h1 = ratio * parts.w * (parts.W / parts.H)
  
      # Half of the total vertical reduction w.r.t figure height
      dh = (parts.h - h1) * facet.nrow / 2
  
      # Reduce plot area height
      grid.top -= dh
      grid.bottom += dh
      grid.hspace = parts.sh / h1
  
      # Add more vertical plot margin
      spaces.t.plot_margin += dh
      spaces.b.plot_margin += dh
      return params
  
file_path: plotnine/plotnine/_mpl/_plotnine_tight_layout.py
imports: from __future__ import annotations
  import typing
  from copy import deepcopy
  from dataclasses import dataclass
  from matplotlib.offsetbox import AnchoredOffsetbox
  from ._plot_side_space import LRTBSpaces, WHSpaceParts, calculate_panel_spacing
label_desc: Use image node_id 3 for calling the TightParams obj's underlying member method code with example usage: obj._reduce_height(facet, ratio, parts) and returns: params