我有一组日期和事件,例如:
<?php next_post_link( '<div class="nav-next">%link</div>', '<span class="fa fa-chevron-up icn"></span>' . _x( get_next_post()->post_title, '<span class="hidden-sm hidden-xs">Previous post link</span><span class="hidden-xl hidden-lg hidden-md">Prev</span>', 'bnNav' ) ); ?>
<?php previous_post_link( '<div class="nav-previous">%link</div>', _x( get_previous_post()->post_title, '<span class="hidden-sm hidden-xs">Next post link</span><span class="hidden-xl hidden-lg hidden-md">Next</span>', 'bnNav' ). '<span class="fa fa-chevron-up icn"></span>'); ?>
我想制作一个条形图,在x轴上有日期,条形高度代表每个日期每个事件的累积频率。
答案 0 :(得分:1)
你的意思是这样的:
# Generate data
set.seed(23)
t <- c(rep("1990-01-01", 10), rep("1990-01-02", 10))
v <- sample(c("A","B","C"), 20, replace=TRUE)
# Side-by-side barplot
quartz()
barplot(t(apply(table(v,t),1,cumsum)), beside=T, col=c("purple", "darkblue", "skyblue"))
legend("topleft", legend=c("A", "B", "C"), col=c("purple", "darkblue", "skyblue"), pch=15)