【发布时间】:2022-01-13 00:54:38
【问题描述】:
现在它在 x 轴上绘制数值变量“1,2,3,4”等,而我希望它绘制游戏图。正如您在第 85 行中看到的,axis(1,Champ$game) 我想要游戏名称在 x 轴上,但它只是为游戏编号而不是放置游戏名称。我该如何解决?
par(mar=c(5, 4, 4, 6) + 0.1)
plot(Champ$daily_max_vel, pch = 16, axes = FALSE, ylim =
c(3.0,3.9),type = "b", col = "black", ylab = "", xlab = "",
main = "Athlete")
##Creates y-axis for graph 1
axis(2, ylim = c(0,1), col = "black", las = 1)
mtext("Velocity (m/s)", side = 2, line = 2.5)
box()
## Allows for second plot on same graph
par(new = TRUE)
#Plotting second graph
plot(Champ$daily_peak_power, pch = 1, xlab = "", ylab = "",
ylim = c(1000,1600), axes = FALSE, type = "b",
col = "orange")
#Creating Second Axis
mtext("Power (W)", side = 4, col = "orange", line = 4)
axis(4,ylim = c(1200,1600), col = "orange", col.axis =
"orange", las = 1)
axis(1,Champ$game)
【问题讨论】:
-
您能否尝试给我们您的数据样本,例如使用
dput()或其他方法?请使用实际代码,而不是截图