Start graph curve at (0,0) to see overlapping trend

I have a graph that that plots cases by 4 select countries. US, Italy, Iran. I am looking to change plot of the graph so that they all start at the origin of (0,0) that way I can see where 1 trend in increasing / decreasing. Attached I have included a picture of how my graph looks now, but as-well the code of how I produced it.

I tried using scale_y_continuous(limits=c(0,max(data but this was the wrong approach, see second screenshot, I'd like for all the plots to start in the same place.

Graph As-IS

How I want to transform graph

Code To Create

#Read In The Files

#these libraries are necessary

#create the URL where the dataset is stored with automatic updates every day
url <- paste("",format(Sys.time(), "%Y-%m-%d"), ".xlsx", sep = "")

#download the dataset from the website to a local temporary file
GET(url, authenticate(":", ":", type="ntlm"), write_disk(tf <- tempfile(fileext = ".xlsx")))

#read the Dataset sheet into “R”
data <- read_excel(tf)

data %>%
  filter(countriesAndTerritories %in% c("United_States_of_America", "Iran", "Italy")) %>% 
  arrange(countriesAndTerritories, dateRep) %>% 
  group_by(countriesAndTerritories) %>% 
  mutate(cum_cases = cumsum(cases)) %>% 
  filter(cum_cases >= 100) %>% 
  ggplot(aes(dateRep, cases, colour = countriesAndTerritories)) +
  geom_point() +
  scale_y_log10() +

Could you try adding

ylim(c(0, max(data$cases))

to see if that helps?

25 posts were split to a new topic: Adding Vertical Lines to plot, "Error in int_abline(...) : has not been called yet"

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.