图中标签和尺寸的问题

时间:2014-11-27 17:57:11

标签: r plot

绘制数据时遇到问题。我想改变x轴的刻度。脚本是:

png(file="plot_day101112.png")
plot(table(created.day_10_df$created.hour),ylab="tweets",type="p",xlab="Time",axes=FALSE,labels=TRUE)
axis(1,at=seq(0,24,1))
lines(table(created.day_11_df$created.hour),ylab="tweets",type="l",xlab="Time")
lines(table(created.day_12_df$created.hour),ylab="tweets",type="b",xlab="Time")
legend(1,1000,"points for the day 10, lines for the day 11, both for the day 12")
dev.off()

此图表将被过度绘制,并且没有y轴的刻度。 我该如何更正此图表?

我有另一个类似的问题来绘制直方图。我希望x轴的标签具有这些值:(8,9,10,11,12,13,14,15,16,17,18,19,20)。我不明白为什么用这个剧本:

png(file="plot_tweets_hour.png")
par(mfrow=c(1,2))
hist(doc0$created.hours,"hours",format="%d %H",freq=TRUE,axes=FALSE,main="Absolute frequency",xlab="Time")
axis(1,at=seq(8,20,1))
axis(2,at=NULL)
hist(doc0$created.hours,"hours",format="%d %H",freq=FALSE,axes=FALSE,main="Relative frequency",xlab="Time")
axis(1,at=seq(8,20,1))
axis(2,at=NULL)
dev.off()

x轴的标签不会出现。 非常感谢

0 个答案:

没有答案