Reprex from this website:
library(tidyverse) library(plotly) # Create data frame df <- data.frame(State = state.name, LifeExp = state.x77[,4], Population = state.x77[,1], stringsAsFactors = F) %>% remove_rownames() # Create ggplot p <- ggplot(df, aes(x = LifeExp, y = Population, label = State)) + geom_point(color = 'tomato', size = 2.5) + theme_minimal() + scale_x_continuous(labels = scales::comma) + scale_y_continuous(labels = scales::comma) + labs(x = 'Life Expectancy (years)', y = 'Population (thousands)', title = 'US State Population and Life Expectancy', subtitle = 'Life expectancy 1969-1971; Population estimate as of July 1, 1975') ggplotly(p) %>% layout(title = list(text = paste0('US State Population and Life Expectancy', '<br>', '<sup>', 'Life expectancy 1969-1971; Population estimate as of July 1, 1975', '</sup>')))
However, comma is not seen on the values !!! How can we fix this ?