R: ggplot2: how would I resize a timeline (still retaining useful information and looking sensible)? -
r version 3.3.2. using ggplot2
, timeline
.
i trying create sensible , aesthetically pleasing timeline. here data:
cambodia.events = data.frame(event = c("french protectorate established", "french protectorate\nbrutally responds cambodian\nuprising","japanese government formally\n recognizes kingdom of cambodia","french forces reimpose\ncolonial administration","french grant cambodian sovereignty", "military coup of norodom sihanouk","khmer republic surrender , beginning of khmer rouge"),date=c(1863,1885,1945,1945,1953,1970,1975)) cambodia = data.frame(grouping = c("ruling body","ruling body","ruling body","ruling body","ruling body","war","ruling body","ruling body","war","ruling body","ruling body","ruling body"),period = c("funan", "chenla/zhenla","khmer empire","dark ages of cambodia","french protectorate","world war two","king norodom sihanouk's rule","khmer regime","vietnam war","khmer rouge","people's republic of kampuchea","modern cambodia"),startdate = c(-500,550,802,1431,1863,1939,1953,1970,1955,1975,1979,1993), enddate = c(550,802,1431,1863,1953,1945,1970,1975,1975,1979,1993,2017))
here code:
require(timeline) p <- timeline(cambodia, cambodia.events, label.col = names(cambodia)[2], group.col = names(cambodia)[1], start.col = names(cambodia)[3], end.col = names(cambodia)[4], text.size = 4, text.color = "black", num.label.steps = 5, event.label.col = names(cambodia.events)[1], event.col = names(cambodia.events)[2], event.group.col = names(cambodia.events)[1], event.spots = 2, event.label='', event.label.method = 1, event.line = true, event.text.size = 4, event.above = false) p + theme_bw() + theme(panel.grid.minor = element_blank(), panel.grid.major = element_blank(), axis.title.y=element_blank(),axis.text.y=element_blank(), axis.ticks.y=element_blank()) + theme(legend.position="none")
yielding this graph.
what able retain information cambodia's past kingdoms, while showing modern events. dealing color , theme come later.
i have tried resizing x axis, did not solve problem , made things little vague ("funan existed around shrug"). tried resizing text, made text smaller- didn't translate plot encompassing information.
so, without oversimplifying x-axis, there way accomplish this?
note: have looked @ both of these recommended questions, , neither answer question.
you can change xaxis scale scale_x_log10, example. keep x axis labels readable, compress image
Comments
Post a Comment