0

Producing a plotly object using ggplotly returns exactly what I need, however, when using api_create() and pushing the object to plotly online, the x-axis appears as numeric, and not a factor as I declared it to be in R.

mem$Office <- as.factor(mem$Office)
mem_plot <- ggplot(data=mem,aes(x=Office,y=Total, fill=Office)) + 
geom_bar(size=mem$Total,width=0.5,position='dodge',stat='identity') + 
labs(x = 'Office', y = 'Total')

mem_plot <- ggplotly(mem_plot,tooltip=c("x","y"))

mem_plot 

Which returns: enter image description here

Then I run: api_create(mem_plot, filename = "memership-plot")

And get this from plot.ly: enter image description here

JDots
  • 45
  • 1
  • 7

1 Answers1

0

Needed to adjust the ggplotly() command.

mem_plot <- ggplotly(mem_plot, dynamicTicks = T)
JDots
  • 45
  • 1
  • 7