dyngpt.pl.plot_density¶
- dyngpt.pl.plot_density(ax, values, weights, x_position, x_label, label_value='Estimated value', vline_flag=True, mean_max_flag=True, max_density_val=2, linewidth=0.75, color='#E61F19', v_color='#E184FF', fill_color='#EBAC80')[source]¶
Plot a density estimate (using kernel density estimation).
- Args:
ax (matplotlib.axes.Axes): The axes to plot the density plot on. values (array-like): The values for which the density is estimated. weights (array-like): The weights associated with the values. x_position (float): The x position for a vertical line indicating the density estimate. x_label (str): The label for the x-axis. label_value (str, optional): The label for the density estimate line. Defaults to ‘Estimated value’. vline_flag (bool, optional): Whether to display a vertical line at the estimated value. Defaults to True. mean_max_flag (bool, optional): Whether to include mean and max vertical lines. Defaults to True. max_density_val (int, optional): The maximum density value to display. Defaults to 2. linewidth (float, optional): The width of the lines. Defaults to 0.75. color (str, optional): The color of the density plot line. Defaults to ‘#E61F19’. v_color (str, optional): The color of the vertical lines. Defaults to ‘#E184FF’. fill_color (str, optional): The color to fill the area under the density curve. Defaults to “#EBAC80”.
- Returns:
(numpy.ndarray, numpy.ndarray): The x and y values of the density estimate.