I am using plotly's code for their splom chart. The code is working, but the data points arent being plotted on the plots that are being created.
Here is my code
pl_colorscale=list(c(0.0, '#19d3f3'),
c(0.333, '#19d3f3'),
c(0.333, '#e763fa'),
c(0.666, '#e763fa'),
c(0.666, '#636efa'),
c(1, '#636efa'))
axis = list(showline=FALSE,
zeroline=FALSE,
gridcolor='#ffff',
ticklen=4)
fig <- df %>%
plot_ly()
fig <- fig %>%
add_trace(
type = 'splom',
dimensions = list(
list(label='Household Income', values=~insurance$income),
list(label='Coverage', values=~insurance$coverage),
list(label='Claim Amount', values=~insurance$claim_amount),
list(label='Retired Status', values=~insurance$retire)
),
text=~class,
marker = list(
color = as.integer(df$class),
colorscale = pl_colorscale,
size = 7,
line = list(
width = 1,
color = 'rgb(230,230,230)'
)
)
)
fig <- fig %>%
layout(
title= 'Insurance Data',
hovermode='closest',
dragmode= 'select',
plot_bgcolor='rgba(240,240,240, 0.95)',
xaxis=list(domain=NULL, showline=F, zeroline=F, gridcolor='#ffff', ticklen=4),
yaxis=list(domain=NULL, showline=F, zeroline=F, gridcolor='#ffff', ticklen=4),
xaxis2=axis,
xaxis3=axis,
xaxis4=axis,
yaxis2=axis,
yaxis3=axis,
yaxis4=axis
)
fig
This outputs the 4x4 plots with each of the variables on the x and y axis but no data points. i am also recieving the warning about NAs introduced by coercion for household income which i think is the same for all of the variables