✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

# Scaling Y axis in contour plots

I know I am doing something fundamentally wrong here but cannot work out what. I have a matrix with NA values on the y-axis at the “0. 75” point but when I plot the contour plot, the blank area of the graph comes up at the “10” and “10.75” point. I am pretty sure it is because of my scaling in my axis (which I have done using a specified equation from plotly), but don’t know where I am going wrong. The other blank areas in the contour plot are correct and are NA values. I would really appreciate any help on this issue. I am new to the plotly forum so apologies if I have not included information that is needed. Please message for further details.

Here is my R script.

p <- plot_ly(z = matrix(c(WW3_MF)), type=“contour”, width=500, height=1074, colorbar = list(title = “Accumulation/Erosion (cm)”),
colorscale=list (c(0, “rgb(0,0,255)”),list(0.65, “rgb(135,206,250)”), list(0.75, “rgb(255,255,0)”), list(0.85, “rgb(255,165,0)”), list(1, “rgb(255,0,0)”)),zauto=F, zmin=-14, zmax=8) %>%

layout(title=“WW3_MF”,

``````   yaxis=list(
``````

title=“Y(m)”, tickmode = “array”,
ticktext = c("-0.75", “-0.1”, “0.1”, “0.5”,“1.5”, “2.5”, “5”, “7.5”, “10”, “10.75”),
tickvals = c(“1”, “1.51”, “1.67”, “1.98”,“2.76”, “3.54”, “5.5”, “7.46”, “9.41”, “10”),
range = c(1,10)),

xaxis=list(
nticks=“4”,
title=“X(m)”,
tickmode = “array”,
ticktext = c(“1”, “2”, “3”),
tickvals = c(“15”, “30”, “45”),
range=0,45),
shapes =list(type = “rect”,
line = list(color = “black”),
x0 = “0”, x1 = “22.5”, xref = “x”,
y0 = “0.58”, y1 = “8.41”, yref = “y”)

)

(
contours = list(
z = list(
show=TRUE,
usecolormap=TRUE,
highlightcolor="#ffA500",
project=list,
countourlabels=“TRUE”

``````  )
)
``````

)

(
scene = list(
camera=list(
eye = list(x=1.87, y=0.88, z=-0.64)
)
)
)

p