On 03/16/2012 01:28 AM, qiao xue wrote:> Hi,
>
> I use R to plot a graph with 20000 frames. Because the limit of pixel
> or others, the screen fail to show the graph. So I have to draw a
> point every 10 frames. So the total of x axis becomes 2000.
> So when imaging the picture, I still hope that the total of x-axis is
> 20000. I need to find a way to modify the number of axis.
> How could I do this?
>
Hi Qiao,
Let's assume that you want a scatterplot:
# first let's indulge our secret desire to make up data
x<-rnorm(20000)+5*sin(seq(0.001,20,by=0.001))
# now plot this data
plot(x)
# Wow! Pretty messy. Now take the mean of every ten
# values to get a vector of 2000 values
x10<-mean(x[1:10])
for(i in 2:2000) x10<-c(x10,mean(x[(i*10):(i*10+9)]))
# when plotting this, add the x values, which were
# previously just made up from the length of the vector
plot(seq(1,20000,by=10),x10)
Jim