我试图从R中相当复杂的数组进行绘制.我想生成一个包含3×3图形的图像,每个图形上都有红色和蓝色点.
我有一个应用循环的结构,但我想改变每行的y最大值.
我通常会使用像我这样的计数器在其他语言中这样做.但R中的应用事情让我感到困惑!
par(mfrow=c(3,3),pty="s") # a 3 by 3 graphic
set.seed(1001)
x <- 1:54 # with 1 to 54 along the x axis
y <- array(rexp(20), dim=c(54,6,3,2)) # and the y axis coming
# from an array with dimensions as shown.
ymax <- c(1,0.1,0.3) # three different y maximum values I want
# on the graphic, one for each row of graphs
counter <- 1 # a counter, starting at 1,
# as I would use in a traditional loop …Run Code Online (Sandbox Code Playgroud)