I have two dataframes
with columns DateTime
, Date
and parameter
. Both dfs
have both the columns where the values for the column Date
are same and the values for the column parameter
are different. Both the dfs
have hourly averaged value for the given parameter, lets say V1
.
I want to plot the value for both V1
from both dfs
together using ggplot2
with 5 days
interval in the x-axis
. As all the dates are coming in the axis, the plot is unreadable.
Here is the code i am using
ggplot() +
geom_point(data=df1, aes(Date, V1), color='blue') +
geom_point(data=df2, aes(Date, V1), color='red') +
theme_bw() +
scale_x_date(breaks="10 days", limits= as.Date(c("2012-12-15", "2013-01-15")))
scale_x_date
doesn't seem to work. It is giving the following error
Error: Invalid input: date_trans works with objects of class Date only
Any help will be appreciated. Thank you in advance.