I am including a secondary y axis/bar chart coincident with a plotly scatterplot, and am getting the following warning:
“Warning: ‘bar’ objects don’t have these attributes: ‘mode’
Valid attributes include: ‘type’,‘visible’,…”
The chart seems to render correctly using the following code:
pmn_now <- plot_ly(file1_sub,x = ~year, y = ~get(input$outcome), name=ylabel, type= "scatter",
mode=("lines+markers"),marker=list( line =list(color="blue"))) %>%
add_trace(x=~year, y=~n_total, type="bar", yaxis="y2", opacity=0.35,
name="Number Total",marker = list(color="orange")) %>%
layout(margin=marginsize,
xaxis = list(title="Title 1",titlefont=list(size=14),tickangle=45),
yaxis = list(title=ylabel,titlefont=list(size=14),tickangle=0,dtick=.1,gridcolor="blue"),
yaxis2 = list(title="Number", overlaying ="y",
side="right",titlefont=list(size=14),tickangle=0),
title = titletext)
legend = list(x = 0, y = 0.9, box.lty=0)
pmn_now
Given that the plot has the desired appearance and the code aligns with other examples I’ve seen, could someone identify the issue and suggest a solution?
Thanks,
Matt