I am attempting to make a barpolar plot with three variables: direction (theta), speed (r), and depth (color). If I map to color at the start with the other two variables, a strange grid appears overlaying the plot, and I cannot seem to figure out how to modify the colorbar (such as adding a title). Code:
fig <-
plot_ly(
data = Data,
r = Data$Speed,
theta = Data$Direction,
color = Data$Depth,
colors = 'Greens',
type = "barpolar",
marker = list(line = list(
width = 4,
colorbar = list(
title = 'Depth',
len = 0.6,
thickness = 25,
x = 1.1
)
))
) %>%
layout(
title = list(text = "Direction and Speed", y = 4),
polar = list(
angularaxis = list(rotation = 90, direction = 'clockwise'),
radialaxis = list(angle = 90, title = "Speed (µm/s)")
)
)
If instead I map to color under marker, I can modify the colorbar, but it has absolutely no connection with the data (different color, different scale). Code:
fig <-
plot_ly(
data = Data,
r = Data$Speed,
theta = Data$Direction,
width = 600,
height = 600,
type = "barpolar",
marker = list(
line = list(
width = 6,
color = Data$Depth,
colorscale = 'Greens'
),
colorbar = list(
title = 'Depth (ft btc)',
len = 0.6,
thickness = 25,
x = 1.1
)
)
) %>%
layout(
title = list(text = "Direction and Speed", y = 0.9),
polar = list(
angularaxis = list(rotation = 90, direction = 'clockwise'),
radialaxis = list(angle = 90, title = "Speed (µm/s)")
)
)
I’m sure the solution is quite simple, and I’ve just been looking at this too long to make sense of it. Any help is appreciated. Thanks!