Hi all, I am using the titanic open source dataset to experiment with scatter plots in plotly. My graph is looking good with the exception of one issue. I noticed that the legend on the right contains values from 0 to 1 in increments of 0.2. I’d like to remove the 0.2 ticks and show only values between 0 and 1 (or label as True or False)
Is there a way do do this via a legend method setting?
Thanks
Jonathan
titanic.sp.df <- read.csv(file=“train.csv”, header=TRUE, sep=",")
What is the mean and median age
mean(titanic.sp.df$Age, na.rm=TRUE) #29.699
median(titanic.sp.df$Age, na.rm=TRUE) #28
replace all Age NA values with the median value
titanic.sp.df$Age[is.na(titanic.sp.df$Age)] <- 28
col_scheme <- c("#3a6587", “#aeb3b7”)
p.scatter2 <- plot_ly(data = titanic.sp.df, x = ~Fare, y = ~Age,
type = ‘scatter’, mode = ‘markers’,
color = ~Survived, colors = col_scheme) %>%
layout(title = “Titanic Passenger Age & Fare by Survial Type”,
xaxis = list(title = “Fare (In Pounds)”, showgrid = FALSE),
yaxis = list(title = “Age (In Years)”, showgrid = FALSE),
legend = l)
p.scatter2