You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: stat_density.m
    path of file: ./repos/gramm/@gramm
    
    the code of the file until where you have to start completion: function obj=stat_density(obj,varargin)
% geom_point Displays an smooth density estimate of the data in x

    
function obj=stat_density(obj,varargin)
% geom_point Displays an smooth density estimate of the data in x
%
% Example syntax (default arguments): gramm_object.stat_density('function','pdf','kernel','normal','npoints',100)
% the 'function','kernel', and 'bandwidth' arguments are the
% ones used by the underlying matlab function ksdensity
% 'npoints' is used to set how many x values are used to
% display the density estimates.
% 'extra_x' is used to increase the range of x values over
% which the estimated density function is displayed. Values
% will be extend