code: def test_changing_xlim_in_stat_density():
      n = 100
      _xlim = (5, 10)
      data = pd.DataFrame(
          {"x": np.linspace(_xlim[0] - 1, _xlim[1] + 1, n)}
      )
      p = ggplot(data, aes("x")) + stat_density() + xlim(*_xlim)
      # No exceptions
      with pytest.warns(PlotnineWarning):
          # warns about removed points.
          p._build()
  
imports: import numpy
  import pandas
  import pytest
  from plotnine import aes, ggplot, stat_bin, stat_density, xlim
  from plotnine.exceptions import PlotnineError, PlotnineWarning
label_desc: Use image node_id 2 for calling a global function with example usage: test_changing_xlim_in_stat_density() without return types