Questions tagged [kdeplot]

These question are for seaborn.kdeplot. Also use the python and seaborn tags.

49 questions
21
votes
1 answer

How to locate the median in a KDE plot

I am trying to do a Kernel Density Estimation (KDE) plot with seaborn and locate the median. The code looks something like this: import seaborn as sns import numpy as np import matplotlib.pyplot as plt sns.set_palette("hls", 1) data =…
n1000
  • 5,058
  • 10
  • 37
  • 65
13
votes
4 answers

seaborn pairgrid: using kdeplot with 2 hues

Here is my effort to plot a pairgrid plot that use the kdeplot in the lower part with 2 hues: My script is: import seaborn as sns g = sns.PairGrid(df2,hue='models') g.map_upper(plt.scatter) g.map_lower(sns.kdeplot) g.map_diag(sns.distplot) Is…
ecasa
  • 131
  • 1
  • 1
  • 3
9
votes
1 answer

Find non overlapping area between two kde plots

I was attempting to determine whether a feature is important or not base on its kde distribution for target variable. I am aware how to plot the kde plot and guess after looking at the plots, but is there a more formal doing this? Such as can we…
BhishanPoudel
  • 15,974
  • 21
  • 108
  • 169
7
votes
2 answers

How to plot a mean line on a kdeplot between 0 and the y value of the mean

I have a distplot and I would like to plot a mean line that goes from 0 to the y value of the mean frequency. I want to do this, but have the line stop at when the distplot does. Why isn't there a simple parameter that does this? It would be very…
bismo
  • 1,257
  • 1
  • 16
  • 36
6
votes
1 answer

How to add a colorbar to the side of a kde jointplot

I'm trying to plot a colorbar next to my density plot with marginal axes. It does plot the colorbar, but unfortunately not on the side. That's what a tried so far: sns.jointplot(x,y, data=df3, kind="kde", color="skyblue", legend=True, cbar=True, …
Mel
  • 81
  • 2
  • 4
6
votes
1 answer

Add labels to bivariate kdeplot

I like the Seaborn example of multiple bivariate KDE plots, but I was hoping to use a standard matplotlib legend instead of the custom labels in that example. Here's an example where I tried to use a legend: import seaborn as sns import…
Don Kirkby
  • 53,582
  • 27
  • 205
  • 286
6
votes
0 answers

How do I use colormaps with variable alpha in a kdeplot without seeing the contour lines?

Python version: 3.6.4 (Anaconda on Windows) Seaborn: 0.8.1 Matplotlib: 2.1.2 I'm trying to create a 2D Kernel Density plot using Seaborn but I want each step in the colourmap to have a different alpha value. I had a look at this question to create a…
Tim B
  • 121
  • 1
  • 7
5
votes
3 answers

Log scales with kdeplot

I am trying to make a nice free energy surface (heat map) using Seaborn's kdeplot. I am very close but can not figure out a way to change the color bar scale. The color bar scale is important since it is supposed to represent the difference in…
4
votes
1 answer

How to set a different linestyle for each hue group in a kdeplot / displot

How can each hue group of a seaborn.kdeplot, or seaborn.displot with kind='kde' be given a different linestyle? Both axes-level and figure-level options will accept a str for linestyle/ls, which applies to all hue groups. import seaborn as…
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
4
votes
2 answers

How to add a colorbar to a kdeplot

I want to create a Kernel-Density-Estimation with seaborn.kdeplot with a colorbar on the side. import matplotlib.pyplot as plt import seaborn as sns import numpy as np; np.random.seed(10) import seaborn as sns; sns.set(color_codes=True) mean, cov =…
Panzerritter
  • 43
  • 1
  • 3
4
votes
1 answer

Extracting characteristic parameters from kdeplots

I would like to be able to extract the characteristic parameters from kernel density plots produced using Python's Seaborn. While there is a very nice example on obtaining the median of a distribution, I'd like to see whether this can be generalized…
daviddesancho
  • 427
  • 1
  • 7
  • 20
3
votes
3 answers

Plotting time on x-axis

I'm working with a dataset that only contains datetime objects and I have retrieved the day of the week and reformatted the time in a separate column like this (conversion functions included below): datetime day_of_week time_of_day 0 …
big_cactus
  • 69
  • 1
  • 6
2
votes
1 answer

How to fill intervals under KDE curve with different colors

I am looking for a way to color the intervals below the curve with different colors; on the interval x < 0, I would like to fill the area under the curve with one color and on the interval x >= 0 with another color, like the following image: This…
Niko Gamulin
  • 66,025
  • 95
  • 221
  • 286
2
votes
1 answer

Hiding values next to seaborn colormap

Here's a picture of the plot I get for a bivariate density. However the numbers next to the colorbar are really not of much use here, and I would like either to delete them or replace by 'LOW' and 'HIGH'. I didn't find any way of doing this so if…
Lucien Ledune
  • 120
  • 11
2
votes
1 answer

How to shade kdeplot under a certain value

I would like to shade the area under the kdeplot below the value -1.64. I drew the kdeplot and a vertical line at -1.64. How do I fill the triangular area between the kdeplot, the x-axis, and the vertical line? Also, I would like the height of the…
jisoo
  • 21
  • 2
1
2 3 4