code: def resolution(x, zero=True):
      """
      Compute the resolution of a data vector
  
      Resolution is smallest non-zero distance between adjacent values
  
      Parameters
      ----------
      x : array_like
          1-Dimension
      zero : Boolean
          Whether to include zero values in the computation
  
      Result
      ------
      res : resolution of x
          If x is an integer array, then the resolution is 1
      """
      from mizani.bounds import zero_range
  
      x = np.asarray(x)
  
      # (unsigned) integers or an effective range of zero
      _x = x[~pd.isna(x)]
      _x = (x.min(), x.max())
      if x.dtype.kind in ("i", "u") or zero_range(_x):
          return 1
  
      x = np.unique(x)
      if zero:
          x = np.unique(np.hstack([0, x]))
  
      return np.min(np.diff(np.sort(x)))
  
imports: from __future__ import annotations
  import inspect
  import itertools
  import warnings
  from collections import defaultdict
  from collections.abc import Iterable, Sequence
  from contextlib import suppress
  from typing import TYPE_CHECKING, cast, overload
  from warnings import warn
  import numpy
  import pandas
  from pandas.core.groupby import DataFrameGroupBy
  from ..exceptions import PlotnineError, PlotnineWarning
  from ..mapping import aes
label_desc: Use image node_id 31 for calling a global function with example usage: resolution(x, zero) and returns: np, int