is there any way to plot a graph like this in R and have the same 12 axes on it with thier name ?
here's a pic for the graph.
here's a piece of my data
Date1 Time TravelTime
1 2016-09-04 13:11 34
2 2016-09-04 13:12 34
3 2016-09-04 13:13 33
4 2016-09-04 13:14 33
5 2016-09-04 13:15 33
6 2016-09-04 13:16 43
7 2016-09-04 13:17 44
8 2016-09-04 13:18 44
9 2016-09-04 13:19 40
10 2016-09-04 13:20 39
here's the output from dput
structure(list(Date1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L), .Label = "2016-09-04", class = "factor"), Time = structure(1:10, .Label = c("13:11",
"13:12", "13:13", "13:14", "13:15", "13:16", "13:17", "13:18",
"13:19", "13:20"), class = "factor"), TravelTime = c(34L, 34L,
33L, 33L, 33L, 43L, 44L, 44L, 40L, 39L)), .Names = c("Date1",
"Time", "TravelTime"), row.names = c(NA, -10L), class = "data.frame")
here's my data for 5 days
here's another graph that shows the Time-Spiral ... May you please change your graph to spiral, not a circular ?
i got the graph from this link here
The overall approach is to summarize the data into time bins (I used 15-minute bins), where each bin's value is the average travel time for values within that bin. Then we use the POSIXct date as the y-value so that the graph spirals outward with time. Using
geom_rect
, we map average travel time to bar height to create a spiral bar graph.First, load and process the data:
Now, summarize the data into 15-minute time-of-day bins with the mean travel time for each bin and create a "spiral time" variable to use as the y-value:
Finally, plot the data. Each 15-minute hour-of-day bin gets its own segment, and we use travel time for the color gradient and the height of the bars. You could of course map fill color and bar height to two different variables if you wish (in your example, fill color is mapped to month; with your data, you could map fill color to date, if that is something you want to highlight).
Below are two other versions: The first uses
geom_segment
and, therefore, maps travel time only to fill color. The second usesgeom_tile
and maps travel time to both fill color and tile height.geom_segment
versiongeom_tile
version