折线图未显示y值标签

时间:2019-02-15 05:40:47

标签: r

我是R语言的初学者,正在尝试创建折线图。我已经尝试了好几个小时,但仍然无法理解为什么我的y轴标签不显示。请帮忙!

# Define vector
RR <- c(1.00, 1.00, 1.00, 1.04, 1.08, 1.12, 1.16, 1.21, 1.23)

# Calculate range from 1 to max value 
g_range <- range(1, RR)

# Plot using y axis that ranges from 1 to max 
plot(RR, type="o", col="blue", ylim=g_range, 
     axes=FALSE, ann=FALSE)

# Make x axis 
axis(1, las=2, at=1:9, lab=c("40-45","45-50","50-55","55-60","60-65","65-70","70-75","75-80","80-"))

     
# Make y axis with horizontal labels that display ticks
axis(2, las=1, at=1:6,lab=c("1.00","1.05","1.10","1.15","1.20","1.25"))

# Create box around plot
box()

0 个答案:

没有答案