0

How can I order the weekdays at the x axis(Monday-Sunday)? I am taking the date out of GoogleAnalytics with the googleAnalyticsR library.

library(ggplot2)
library(googleAnalyticsR)

#Session by Hour of Day and Day of Week Query
df1 <- google_analytics_4(my_id, 
                          date_range = c("2017-07-01", "2017-07-31"),
                          metrics = c("transactions"),
                          dimensions = c("dayOfWeekName","hour"),
                          anti_sample = TRUE)

#Heatmap ggplot2
df1 %>%
  ggplot(aes(x=dayOfWeekName, y=hour, fill=transactions)) + 
  geom_tile() + 
  scale_fill_continuous(low = 'white', high = 'green4') 
Ferdi
  • 540
  • 3
  • 12
  • 23
eagle23
  • 35
  • 6
  • Possible duplicate of [Order x axis day values in gggplot2](https://stackoverflow.com/questions/35976244/order-x-axis-day-values-in-gggplot2) – Z.Lin Aug 29 '17 at 10:22
  • Try turning the dayOfWeekName into an ordered factor – MarkeD Sep 21 '17 at 19:51

0 Answers0