Reputation: 13
I created a dataframe datos_f.csv
with 5 columns (date, months, pp, tmax and tmin) from meteorological .csv
data.
I've been trying to plot a time series using one of these variables and the dates, but ggplot2
doesn't plot. It only shows the axis.
I'm novice in R, but I'm trying different methods and nothing is working.
Thanks so much for reading!
My dataframe (with 16071 rows) is:
> head(datos_f)
fecha mes pp tmax tmin
1 1970-01-01 Enero 0.0 29.9 18.2
2 1970-01-02 Enero 0.0 30.3 18.4
3 1970-01-03 Enero 0.0 31.0 18.0
4 1970-01-04 Enero 0.0 29.9 16.8
5 1970-01-05 Enero 0.0 30.2 19.4
6 1970-01-06 Enero 0.0 31.6 18.7
7 1970-01-07 Enero 0.0 32.2 17.8
8 1970-01-08 Enero 0.0 32.0 19.2
9 1970-01-09 Enero 0.0 34.2 18.8
10 1970-01-10 Enero 0.0 33.0 17.4
11 1970-01-11 Enero 0.0 32.8 17.2
12 1970-01-12 Enero 0.0 30.6 18.3
13 1970-01-13 Enero 0.0 33.2 19.4
14 1970-01-14 Enero 0.0 29.4 19.8
15 1970-01-15 Enero 3.9 29.8 20.0
I used this simple order:
ggplot(data=datos_f,aes(x=fecha,y=tmax),geom_point(size=2))
but this shows me an empty image with only the axis:
Any ideas?
Upvotes: 0
Views: 91
Reputation: 1607
ggplot2
syntax is a little bit different from normal R syntaxes. It uses +
operator.
ggplot(data=datos_f,aes(x=fecha,y=tmax)) + geom_point(size=2)
Here +
operator overloads the function geom_point
on the ggplot
object
Upvotes: 2