counts_m <- data_male %>%
group_by(Height) %>%
summarize(counts = sum(Height %in% data_male$Height))
density_plot_m <- plot_ly(x = counts_m$Height,
y = counts_m$counts,showlegend = FALSE,
type = "scatter", mode = "lines",
fill = "tozeroy", fillcolor = "rgba(70,130,180,0.2)",
line = list(color = "rgba(255,255,255,0)"))%>%
layout(title = "Density Curve for Male Heights",
xaxis = list(title = "Heights(inches)"),
yaxis = list(title = "Density"))%>%
add_trace(x = c(65,65), y= c(0,200)
, line =list(color = "darkblue", width = 2))%>%
add_trace(x = c(75,75), y= c(0,751)
, line =list(color = "darkblue", width = 2),
fillcolor = "red")