简体   繁体   中英

Plot only certain points in R

There is a very dense set of points I need to show - the pdf gets very large and I was thinking about only plotting every 10th data point

Example

plot(c(1:100),runif(100))

How do I only plot every 4th data? I know I could create a new input data frame but isn't there some easier thing?

You could do something like this:

x <- runif(100)

# Every 10th element
plot(x[seq.int(1, length(x), 10)])

# Every 4th element
plot(x[seq.int(1, length(x), 4)])

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