How to draw the graph???

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to draw the graph???

Rlotus
I have his code. I wanna draw the graph according to x and y. But at the end when I run the code it gives me only one dot.......it is strange cuz from the loop it has to give 20 dots. Help me plz to draw a graph(((

for (i in seq(1:20))
{rsidpVector= rsidp(1)
x<-mean(rsidpVector)
y<-length(number)
plot(y,x,ylab="sample mean",xlab="sample size")
print (rsidpVector)
print(x)

}


rsidp<-function(x){
        i=0
        {y<-sample(number,x), replace=TRUE}
        return(y)
}
Reply | Threaded
Open this post in threaded view
|

Re: How to draw the graph???

David Winsemius

On Oct 25, 2012, at 2:24 PM, Rlotus wrote:

> I have his code. I wanna draw the graph according to x and y. But at the end
> when I run the code it gives me only one dot.......it is strange cuz from
> the loop it has to give 20 dots. Help me plz to draw a graph(((
>
> for (i in seq(1:20))
> {rsidpVector= rsidp(1)
> x<-mean(rsidpVector)
> y<-length(number)
> plot(y,x,ylab="sample mean",xlab="sample size")
> print (rsidpVector)
> print(x)
>
> }
>
>
> rsidp<-function(x){
> i=0
> {y<-sample(number,x), replace=TRUE}
> return(y)
> }
>
>

Set up the plot before the loo and then use the points function inside the loop.

>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-draw-the-graph-tp4647464.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Alameda, CA, USA

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: How to draw the graph???

Rlotus
plot(y,x, ylab="sample mean",xlab="sample size")
 
for (i in seq(1:20))
> {rsidpVector= rsidp(1)
> x<-mean(rsidpVector)
> y<-length(number)
>print (rsidpVector)
> print(x)

sorry, but how i can use points function in the loop?
Reply | Threaded
Open this post in threaded view
|

Re: How to draw the graph???

David Winsemius

On Oct 25, 2012, at 5:14 PM, Rlotus wrote:

> plot(y,x, ylab="sample mean",xlab="sample size")
>
> for (i in seq(1:20))
>> {rsidpVector= rsidp(1)
>> x<-mean(rsidpVector)
>> y<-length(number)
>> print (rsidpVector)
>> print(x)
>
> sorry, but how i can use points function in the loop?

Tested code provided in response to reproducible examples. The points function will not redraw a new plot with each iteration. It might be the case that you do not even need a loop, but you have not described the problem yet.

--

David Winsemius, MD
Alameda, CA, USA

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: How to draw the graph???

Rlotus
This post has NOT been accepted by the mailing list yet.
i need to draw dots in the graph.
for example I tried function dotchart......if u run its possible to see that there a lot of dots....but i can not to put all dots in one graph......Everything i have is only one dot in the end of running....but I wanna see all dots in one graph....according to  code i need 20 dots.......where in graph x-> mean and y->length(rsidp(i))....

for (i in seq(1:20))
{rsidpVector=rsidp(i)
mean(rsidpVector)
 dotchart (length(rsidpVector), mean (rsidpVector))

}
Reply | Threaded
Open this post in threaded view
|

Re: How to draw the graph???

Rlotus
In reply to this post by David Winsemius
thank u so much for helping