r - Plotting multiple frequency polygon lines using ggplot2 -
i have dataset records have 2 variables: "time" id's of decades, , "latitude" geographic latitudes. have 7 time periods (numbered 26 32).
i want visualize potential shift in latitude through time. need ggplot2 do, plot graph latitude on x-axis , count of records @ latitude on y-axis. need seperate time periods , plot in 1 graph.
i understood need function freqpoly
ggplot2, , got far:
qplot(latitude, data = lat_data, geom = "freqpoly", binwidth = 0.25)
this gives me correct graph of data, ignoring time. how can implement time? tried subsetting data, can't figure out if best way..
so i'm trying graph 7 lines showing frequency distribution in each decade in order latitude shift.
thanks!!
without sample data hard answer try add color=factor(time)
(where time name of column time periods). draw lines each time period in different color.
qplot(latitude, data = lat_data, geom = "freqpoly", binwidth = 0.25, color=factor(time))
Comments
Post a Comment