[R] Plotting Mean in plotting degree distribution

Gábor Csárdi csardi at rmki.kfki.hu
Fri Mar 4 15:30:35 CET 2011


I think this would be rather something like

abline(v=mean(degree(G)))

Best,
Gabor

On Thu, Mar 3, 2011 at 8:04 PM, Scott Chamberlain
<scttchamberlain4 at gmail.com> wrote:
> library(igraph)
> G <- erdos.renyi.game(1000, 1/1000) # a random graph
>
> dd1 = degree.distribution(G)
>
> plot(dd1, xlab = "degree", ylab="frequency")
> abline(h = mean(dd1)) # the mean would be a horizontal line
>
> On Thursday, March 3, 2011 at 4:43 PM, kparamas wrote:
>> Hi,
>>
>> I am plotting degree distribution of a graph using the function,
>>
>> library(igraph)
>> dd1 = degree.distribution(G)
>>
>> plot(dd1, xlab = "degree", ylab="frequency")
>>
>> I would like to plot the mean of the distribution as a vertical line in the
>> attached plot.
>> Please let me know how to do this.
>>
>> Thanks,
>> Kumar http://r.789695.n4.nabble.com/file/n3334375/cdata3_dd.png
>> cdata3_dd.png
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/Plotting-Mean-in-plotting-degree-distribution-tp3334375p3334375.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org 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.
>>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Gabor Csardi <Gabor.Csardi at unil.ch>     UNIL DGM



More information about the R-help mailing list