简体   繁体   中英

R - How to reduce the frequency of appearance of pch in plot?

I would like to plot several time series, with each line showing pch. However, the pch appears on each data point, is there any way I can reduce the frequency of pch appearing on the line, say one pch appears every several data point so that the lines won't appear as a thick line packed with pch?

Here is one approach that might help you. It's hard to know for sure without more details about what you want your output to look like.

x = seq(0, 20, 0.1)

par(mfrow=c(2, 1))

plot(x, x^2, pch=1, main="Before")
points(x, x*10, pch=2)

plot(x, x^2, pch=c(1, rep(NA, 9)), main="After")
points(x, x*10, pch=c(2, rep(NA, 9)))

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM