I have traffic density (number of cars) data of various segments of a road. I want to plot a contour map like in the attached figure in R.
data <- structure(list(timestamp = structure(c(1598950800, 1598950800,
1598950800, 1598951100, 1598951100, 1598951100, 1598951400, 1598951400,
1598951400, 1598951700, 1598951700, 1598951700, 1598952000, 1598952000,
1598952000, 1598952300, 1598952300, 1598952300, 1598952600, 1598952600,
1598952600, 1598952900, 1598952900, 1598952900, 1598953200, 1598953200,
1598953200, 1598953500, 1598953500, 1598953500, 1598953800, 1598953800,
1598953800, 1598954100, 1598954100, 1598954100, 1598954400, 1598954400,
1598954400), tzone = "UTC", class = c("POSIXct", "POSIXt")),
Road_segment = c("L1", "L2", "L3", "L1",
"L2", "L3", "L1", "L3", "L2",
"L2", "L3", "L1", "L1", "L3",
"L2", "L2", "L3", "L1", "L1",
"L3", "L2", "L1", "L2", "L3",
"L3", "L2", "L1", "L2", "L3",
"L1", "L1", "L2", "L3", "L1",
"L2", "L3", "L3", "L2", "L1"
), length_mi = c(2, 1.5, 1,
2, 1.5, 1,
2, 1, 1.5,
1.5, 1, 2,
2, 1, 1.5,
1.5, 1, 2,
2, 1, 1.5,
2, 1.5, 1,
1, 1.5, 2,
1.5, 1, 2,
2, 1.5, 1,
2, 1.5, 1,
1, 1.5, 2),
avg_tdensity = c(59.9809611866698, 56.3123856677006, 57.6719458363159,
59.3508907977412, 56.4167760279965, 57.3786586335799, 56.8455221506403,
53.8045315358307, 54.8844746679392, 54.9068440308598, 52.5369343036666,
54.0965759961823, 53.7734629762189, 53.8517557464408, 53.941233198123,
57.5837111270182, 54.4867971049073, 59.4453392189613, 61.6561779209417,
55.8401435616003, 60.4730871709218, 63.5737294201861, 66.6594587608367,
56.9064165274795, 58.3753380259286, 65.83552055993, 63.5973415254911,
55.3480175773483, 56.538564781675, 54.6707229778096, 58.3641533444683,
52.1665970730931, 56.8069971367215, 60.7017517696652, 53.6516742225404,
56.3745227869244, 53.4913604549431, 52.4971665473634, 56.1781694901774
)), row.names = c(NA, -39L), class = c("tbl_df", "tbl", "data.frame"
))
Please help me to plot.