'Plotting in ggplot2 with only an x axis requirement
I have a dataframe, with NA's. State names are column headers, and dates are the row headers. How can I use ggplot() to plot the columns, with dates on the x axis, and some arbitrary scale on the y axis?
Florida Iowa Pennsylvania Nevada Georgia South.Carolina Montana Maine Arizona North.Carolina
January 2019 NA NA NA NA NA NA NA NA NA 46.33333
February 2019 NA NA NA NA NA NA NA NA 40.25000 35.75000
March 2019 NA 48.2 49.66250 48.78 NA NA NA NA NA NA
April 2019 44.00000 44.0 48.50000 NA NA NA NA NA NA NA
May 2019 48.36000 NA 47.33333 NA NA NA NA NA 40.66667 NA
June 2019 46.61429 NA 37.50000 NA NA 34.25 NA 52.4 NA 46.60000
Is there a way to incorporate a 'predictive' connecting line between observations and NA's in the chart (by state) so that it may not be strictly linear through the unknown space?
I can get the x axis correct, but not the y or the plots.
ggplot(demplot, aes(x = seq.Date(from = as.Date('2019-01-01'), to = as.Date('2020-11-01'),by = "month"))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
