python - Seaborn kdeplot not plotting some data? -
i'm trying seaborn kdeplot example work on dataset. reason, 1 of datasets isn't plotting @ all, other seems plotting fine. minimal working example, have sampled 10 rows large data sets.
my input data looks this:
#dataframe dfa index x y category 0 595700 5 1.000000 14.0 1 293559 4 1.000000 14.0 2 562295 3 0.000000 14.0 3 219426 4 1.000000 14.0 4 592731 2 1.000000 14.0 5 178573 3 1.000000 14.0 6 553156 4 0.500000 14.0 7 385031 1 1.000000 14.0 8 391681 3 0.999998 14.0 9 492771 2 1.000000 14.0 # dataframe dfb index x y category 0 56345 3 1.000000 6.0 1 383741 4 1.000000 6.0 2 103044 2 1.000000 6.0 3 297357 5 1.000000 6.0 4 257508 3 1.000000 6.0 5 223600 2 0.999938 6.0 6 44530 2 1.000000 6.0 7 82925 3 1.000000 6.0 8 169592 3 0.500000 6.0 9 229482 4 0.285714 6.0
my code snippet looks this:
import seaborn sns import matplotlib.pyplot plt sns.set(style="darkgrid") # set figure f, ax = plt.subplots(figsize=(8, 8)) # draw 2 density plots ax = sns.kdeplot(dfa.x, dfa.y, cmap="reds", shade=true, shade_lowest=false) ax = sns.kdeplot(dfb.x, dfb.y, cmap="blues", shade=true, shade_lowest=false)
why isn't data dataframe dfa
plotting?
i don't think gaussian kde fit either of datasets. have 1 variable discrete values , 1 variable large majority of values seem constant. not modeled bivariate gaussian distribution.
as happening, without full dataset cannot sure, expect kde bandwidth (particularly on y axis) ending very narrow such regions non-negligible density tiny. try setting wider bandwidth, advice use different kind of plot data.
Comments
Post a Comment