code: def _compute_univariate_density(
      self,
      data_variable,
      common_norm,
      common_grid,
      estimate_kws,
      warn_singular=True,
  ):
      # Initialize the estimator object
      estimator = KDE(**estimate_kws)
  
      if set(self.variables) - {"x", "y"}:
          if common_grid:
              all_observations = self.comp_data.dropna()
              estimator.define_support(all_observations[data_variable])
      else:
          common_norm = False
  
      all_data = self.plot_data.dropna()
      if common_norm and "weights" in all_data:
          whole_weight = all_data["weights"].sum()
      else:
          whole_weight = len(all_data)
  
      densities = {}
  
      for sub_vars, sub_data in self.iter_data(
          "hue", from_comp_data=True
      ):
          # Extract the data points from this sub set and remove nulls
          observations = sub_data[data_variable]
  
          # Extract the weights for this subset of observations
          if "weights" in self.variables:
              weights = sub_data["weights"]
              part_weight = weights.sum()
          else:
              weights = None
              part_weight = len(sub_data)
  
          # Estimate the density of observations at this level
          variance = np.nan_to_num(observations.var())
          singular = len(observations) < 2 or math.isclose(variance, 0)
          try:
              if not singular:
                  # Convoluted approach needed because numerical failures
                  # can manifest in a few different ways.
                  density, support = estimator(
                      observations, weights=weights
                  )
          except np.linalg.LinAlgError:
              singular = True
  
          if singular:
              msg = (
                  "Dataset has 0 variance; skipping density estimate. "
                  "Pass `warn_singular=False` to disable this warning."
              )
              if warn_singular:
                  warnings.warn(msg, UserWarning, stacklevel=4)
              continue
  
          # Invert the scaling of the support points
          _, f_inv = self._get_scale_transforms(self.data_variable)
          support = f_inv(support)
  
          # Apply a scaling factor so that the integral over all subsets is 1
          if common_norm:
              density *= part_weight / whole_weight
  
          # Store the density for this level
          key = tuple(sub_vars.items())
          densities[key] = pd.Series(density, index=support)
  
      return densities
  
imports: from numbers import Number
  from functools import partial
  import math
  import textwrap
  import warnings
  import numpy
  import pandas
  import matplotlib
  import matplotlib.pyplot
  import matplotlib.transforms
  from matplotlib.cbook import normalize_kwargs
  from matplotlib.colors import to_rgba
  from matplotlib.collections import LineCollection
  from ._base import VectorPlotter
  from ._statistics import ECDF, Histogram, KDE
  from ._stats.counting import Hist
  from .axisgrid import FacetGrid, _facet_docs
  from .utils import remove_na, _get_transform_functions, _kde_support, _check_argument, _assign_default_kwargs, _default_color
  from .palettes import color_palette
  from .external import husl
  from .external.kde import gaussian_kde
  from ._docstrings import DocstringComponents, _core_docs
label_desc: Use image node_id 11 for calling the _DistributionPlotter obj's underlying member method code with example usage: obj._compute_univariate_density(data_variable, common_norm, common_grid, estimate_kws, warn_singular) and returns: densities