I am seeking assistance in changing the color of the x-axis to white in a Plotly graph that includes two y-axes. In the provided code below, my attempt to conceal the x-axis by setting it to white is not successful. I would appreciate any suggestions on how to achieve this. Thank you!
df <- tibble(x = 1:10, y1= seq(2, 6.5, .5), y2 = seq(4, -5, -1))
fig <- plotly::plot_ly()
fig <- fig %>%
plotly::add_trace(data = df,
x = ~x,
y = ~y1,
type = 'scatter',
mode = 'lines',
linetype = "solid",
name = "y1 axis"
)
fig <- fig %>%
plotly::add_trace(data = df,
x = ~x,
y = ~y2,
type = 'scatter',
mode = 'lines',
linetype = "solid",
yaxis = "y2",
name = "y2 axis"
)
x <- list(
title = '',
zerolinecolor = "#FFFFFF",
zerolinewidth = 2,
gridcolor = "#FFFFFF")
y <- list(
title = '',
zerolinecolor = '#ffff',
zerolinewidth = 2,
gridcolor = "#FFFFFF")
y2 <- list(
overlaying = "y",
side = "right")
fig <- fig %>%
layout(xaxis = x,
yaxis = y,
yaxis2 = y2)
fig
I was expecting to format the color of the x-axis when there are two y-axis.
Created on 2023-12-06 with reprex v2.0.2