我的图表如下: http://i.imgur.com/CjIKFCV.jpg我想保持刻度线旋转,因为最后我将使用更多的数据.解决方案这是您要找的东西吗? > with(my_data, plot(comp_count, axes = FALSE, xlab = "", type = 'l'))> axis(2)> axis(1, at = my_data$date, labels = FALSE)> ticks <- my_data$date[c(TRUE, FALSE)]> text(seq(1, length(my_data$date), 2), par("usr")[3] - 0.25, srt = 45, adj = 1, labels = ticks, xpd = TRUE)> box() Having trouble getting my x-axis to look right.I would like the ticks and labels to appear for every second observation. Unfortunately, while my code displays ticks appropriately, label values increase by 1 each time.In other words I would like the tick labels to be 2011-10-21, 2011-10-23, 2011-10-25.... My code currently produces tick labels as2011-10-21, 2011-10-22, 2011-10-23 ...My data frame looks like:date comp_count1 2011-10-21 102 2011-10-22 33 2011-10-23 14 2011-10-24 15 2011-10-25 16 2011-10-26 2Here is the code I'm running:plot(my_data$comp_count, main="comped sites over time", col="blue", type='l', lwd=2, axes=FALSE, xlab="date", ylab="count")axis(1,at=2*0:nrow(my_data), lab=FALSE)text(2*0:nrow(my_data), par("usr")[3]-1, lab=my_data$date, srt=45, adj=1, xpd=TRUE, cex=0.8)My chart looks like:http://i.imgur.com/CjIKFCV.jpgI would like to keep the tick labels rotated since I will be using much more data in the end. 解决方案 Is this what you're looking for? > with(my_data, plot(comp_count, axes = FALSE, xlab = "", type = 'l'))> axis(2)> axis(1, at = my_data$date, labels = FALSE)> ticks <- my_data$date[c(TRUE, FALSE)]> text(seq(1, length(my_data$date), 2), par("usr")[3] - 0.25, srt = 45, adj = 1, labels = ticks, xpd = TRUE)> box() 这篇关于每秒显示一次刻度(旋转标签)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-05 11:54