code: def n_to_nrow_ncol(n: int) -> tuple[int, int]:
      """
      Compute the rows and columns given the number of plots.
      """
      if n <= 3:
          nrow, ncol = 1, n
      elif n <= 6:
          nrow, ncol = 2, (n + 1) // 2
      elif n <= 12:
          nrow, ncol = 3, (n + 2) // 3
      else:
          ncol = int(np.ceil(np.sqrt(n)))
          nrow = int(np.ceil(n / ncol))
      return (nrow, ncol)
  
file_path: plotnine/plotnine/facets/facet_wrap.py
imports: from __future__ import annotations
  import re
  import typing
  from warnings import warn
  import numpy
  import pandas
  from .._utils import join_keys, match
  from ..exceptions import PlotnineError, PlotnineWarning
  from .facet import add_missing_facets, combine_vars, eval_facet_vars, facet, layout_null
  from .strips import Strips, strip
label_desc: Use image node_id 4 for calling a global function with example usage: n_to_nrow_ncol(n) and returns: nrow,  ncol