✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Formatting Y-Axis label and HoverText numbers to K with one decimal place (e.g. 190,000.7k)


I am trying to format a bar chart (Plotly R) with large numbers to K with one decimal place (e.g. 190,000.7k). Since the numbers range between: < 1 Million to 100s of Millions, they default to M without formatting.

The formatting ~round(C4/1000,2) does not seem to work as intended in the code shown below. I would like to have 190.0007M displayed as 190,000.7k

plot_ly(Waterfall_C4, x = ~Parameter, y = ~round(C4/1000,2) measure = ~type, type = “waterfall”,
width = 400, height = 400) %>%
layout(yaxis = list(title = “C4”))