3

I'm a little confused as to why ggplot can render geom_area correctly in the first plot, but when wrapped with ggplotly it produces something a little different. Any insights?

library(tidyverse)
library(plotly)

my_dates <- Sys.Date() + c(1,2,3,4,4,5,6)

my_data <- tibble(a = my_dates,
                  b = c(1,3,7,10,14,16,22))

my_plot <- ggplot(my_data, aes(a, b)) +
  geom_line() +
  geom_area(position = "identity", alpha = 0.6)

my_plot

ggplotly(my_plot)

Created on 2020-04-03 by the reprex package (v0.3.0)

Ryan
  • 281
  • 3
  • 12
  • 1
    It looks like the area is parameterised as a polygon and the two vertices that share the same x-location (Apr 05) were accidentally reordered in the plotly one. Don't know how to fix though. – teunbrand Apr 03 '20 at 14:26

0 Answers0