kernel-density

Adapt von Mises KDE to Seaborn

Adapt von Mises KDE to Seaborn Question: I am attempting to use Seaborn to plot a bivariate (joint) KDE on a polar projection. There is no support for this in Seaborn, and no direct support for an angular (von Mises) KDE in Scipy. scipy gaussian_kde and circular data solves a related but different case. Similarities …

Total answers: 2

How to fix seaborn kde error for geographic coordinates

How to fix seaborn kde error for geographic coordinates Question: I have the following dataframe (2000 rows) Latitude Longitude 31.400091 -109.782830 31.400091 -108.782830 31.410091 -108.782830 31.405091 -109.782830 31.400091 -110.77830 31.460091 -12.782830 … … I’m currently trying to represent it the point mass concentration with kde from seaborn package : x = df[‘Longitude’] y = df[‘Latitude’] …

Total answers: 1

KDE – Is there something wrong in scipy or numpy? Or is it something I am doing?

KDE – Is there something wrong in scipy or numpy? Or is it something I am doing? Question: I am simply trying to follow an example: https://medium.com/swlh/how-to-analyze-volume-profiles-with-python-3166bb10ff24 I am only on the second step and I am getting errors. Here is my code: # Load data df = botc.ib.data_saver.get_df(SYMBOL.lower()) # Separate for vol prof volume …

Total answers: 1

How can I find the mode (a number) of a kde histogram in python

How can I find the mode (a number) of a kde histogram in python Question: I want to determine the X value that has the highest pick in the histogram. The code to print the histogram: fig=sns.displot(data=df, x=’degrees’, hue="TYPE", kind="kde", height=6, aspect=2) plt.xticks(np.arange(10, 20, step=0.5)) plt.xlim(10, 20) plt.grid(axis="x") Histogram and value wanted (in fact, I …

Total answers: 2

How to create a pandas density plot with datetime.date on the x-axis

How to create a pandas density plot with datetime.date on the x-axis Question: #dataframe a= timestamp count 2021-08-16 20 2021-08-17 60 2021-08-18 35 2021-08-19 1 2021-08-20 0 2021-08-21 1 2021-08-22 50 2021-08-23 36 2021-08-24 68 2021-08-25 125 2021-08-26 54 I applied this code a.plot(kind="density") this is not what i want. I want to put Count …

Total answers: 1

Kernel Density Estimation using scipy's gaussian_kde and sklearn's KernelDensity leads to different results

Kernel Density Estimation using scipy's gaussian_kde and sklearn's KernelDensity leads to different results Question: I created some data from two superposed normal distributions and then applied sklearn.neighbors.KernelDensity and scipy.stats.gaussian_kde to estimate the density function. However, using the same bandwith (1.0) and the same kernel, both methods produce a different outcome. Can someone explain me the …

Total answers: 3

Plotting KDE with logarithmic x-data

Plotting KDE with logarithmic x-data Question: I want to plot a KDE for some data with data that covers a large range in x-values. Therefore I want to use a logarithmic scale for the x-axis. For plotting I was using seaborn and the solution from Plotting 2D Kernel Density Estimation with Python, both of which …

Total answers: 1

How to plot a 3D density map in python with matplotlib

How to plot a 3D density map in python with matplotlib Question: I have a large dataset of (x,y,z) protein positions and would like to plot areas of high occupancy as a heatmap. Ideally the output should look similiar to the volumetric visualisation below, but I’m not sure how to achieve this with matplotlib. My …

Total answers: 1

Multivariate kernel density estimation in Python

Multivariate kernel density estimation in Python Question: I am trying to use SciPy’s gaussian_kde function to estimate the density of multivariate data. In my code below I sample a 3D multivariate normal and fit the kernel density but I’m not sure how to evaluate my fit. import numpy as np from scipy import stats mu …

Total answers: 2