Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何根据R中的条件使用不同的标记(';x';和';o';)进行绘图_Linux_Unix_R_Statistics - Fatal编程技术网

Linux 如何根据R中的条件使用不同的标记(';x';和';o';)进行绘图

Linux 如何根据R中的条件使用不同的标记(';x';和';o';)进行绘图,linux,unix,r,statistics,Linux,Unix,R,Statistics,我的数据如下所示: for_y_axis <-c(0.49534,0.80796,0.93970,0.99998) for_x_axis <-c(1,2,3,4) count <-c(0,33,0,4) _y_轴的这听起来怎么样?根据需要调整pch for_y_axis <- c(0.49534,0.80796,0.93970,0.99998) for_x_axis <- c(1,2,3,4) count <- c(0,33,0,4) zeroc

我的数据如下所示:

for_y_axis <-c(0.49534,0.80796,0.93970,0.99998)
for_x_axis <-c(1,2,3,4)
count      <-c(0,33,0,4)

_y_轴的
这听起来怎么样?根据需要调整pch

for_y_axis <- c(0.49534,0.80796,0.93970,0.99998)
for_x_axis <- c(1,2,3,4)
count <- c(0,33,0,4)

zerocount <- function(x) {
    ifelse (x == 0, x <- 0, x <- 1)
}

pts <- sapply(count, zerocount)
plot(for_x_axis, for_y_axis, type = "n")
points(for_x_axis, for_y_axis, pch = pts)

对于_y_axis@mdsummer:非常感谢。有没有添加颜色的方法。e、 g.“x”表示“红色”,而“o”表示“绿色”。@neversaint:相同的想法
绘图(对于x轴,对于y轴,pch=ifelse(计数>0,“x”,“o”),col=ifelse(计数>0,“红色”,“绿色”)
for_y_axis <- c(0.49534,0.80796,0.93970,0.99998)
for_x_axis <- c(1,2,3,4)
count <- c(0,33,0,4)

zerocount <- function(x) {
    ifelse (x == 0, x <- 0, x <- 1)
}

pts <- sapply(count, zerocount)
plot(for_x_axis, for_y_axis, type = "n")
points(for_x_axis, for_y_axis, pch = pts)