✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
📊 Dash 2.0 is Arriving. Register here. # About Conditional Density Plot and Spinogram

Hello

Can some one help me to figure out how to create a Conditional Density Plot and a Spinogram in Python with Plotly?

I find conditional density plot and spinogram as good visualisation tools in classification problems.

In R, I use the following function from the graphics package to create the graph(s). If you use R, kindly run the example below to get an idea if the plot I’m trying to create.

Appreciate any help! Thank you…

Example,
fail <- factor(c(2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1,
1, 2, 1, 1, 1, 1, 1),
levels = 1:2, labels = c(‘no’, ‘yes’))
temperature <- c(53, 57, 58, 63, 66, 67, 67, 67, 68, 69, 70, 70,
70, 70, 72, 73, 75, 75, 76, 76, 78, 79, 81)

## CD plot

cdplot(fail ~ temperature)
cdplot(fail ~ temperature, bw = 2)

## treatment and improvement of patients with rheumatoid arthritis

treatment <- factor(rep(c(1, 2), c(43, 41)), levels = c(1, 2),
labels = c(“placebo”, “treated”))
improved <- factor(rep(c(1, 2, 3, 1, 2, 3), c(29, 7, 7, 13, 7, 21)),
levels = c(1, 2, 3),
labels = c(“none”, “some”, “marked”))

## (dependence on a categorical variable)

(spineplot(improved ~ treatment))