✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Small colorbar next to figure after Plot_ly package update


so, I’m plotting a heatmap with a colorbar. I actually had no problems with this plot, but then I updated my Plot_ly package, and now this plot generates a very small colorbar next to my heatmap, no matter what I try to do with it.


col = c("#00007F", "#0000FF", "#007FFF", "#00FFFF", "#7FFF7F", "#FFFF00", "#FF7F00", "#FF0000", "#7F0000");
f = list(size = 18);
plot_ly(data = pred, 
        x = ~distance, 
        y = ~altitude, 
        z = ~ch4,
        type = 'heatmap',
        colors = colorRampPalette(col) (length(pred$ch4)),
        text = paste('<br>Altitude:', round(pred$altitude,2), ' [m]<br>Distance:', round(pred$distance,2),'<br>Enhancement:', round(pred$ch4,1), ' [ppb]<br>'),
        hoverinfo="text") %>%
   colorbar(title = 'CH<sub>4</sub> [ppb]') %>%
   layout(yaxis = list(title = "Altitude [m]", titlefont = f),
          xaxis = list(title = "Distance [m]", titlefont = f),
          margin = list(l=80, t=50, b=50, r=40),

Here’s an image of how this code produced a plot vs. how it produces it now.

If anyone has any idea what I can do to get the colorbar to scale properly again, I’d be very grateful.


To give a little context of what I’ve already tried to fix this, I’ve looked into the “colorbar” parameters “lenmode” and “len”, but no matter what I change there affects the colorbar. However, I can change parameters like “thickness” to make it wider. It seems to be just a length issue. Maybe there is something buggy going on with the “len” parameter?


I still have not found a solution to this. If anyone has a good solution, that’s be great, because its really annoying having half a colorbar…


Same problem was posted here, but no solution so far. The fuction ‘len=’ should be working, but it isn’t. It is considered to be a bug.
Although it is working in js: