[R] Barplot for degree distribution

David Winsemius dwinsemius at comcast.net
Wed Apr 27 15:03:36 CEST 2011


On Apr 27, 2011, at 12:00 AM, kparamas wrote:

> Thanks for the info.
>
> I have 2 degree distributions that have different degrees.

Do you mean a different range of values?

>
> I want both these barplots to have the same axes. Is this possible?
> I have used xlim and ylim. ylim works fine for both plots
> But xlim I am not getting the values till 60. And if I give  
> names(dd) <-
> 0:60 it gives an error.

An error you say? .... WHICH ERROR?

>
> library(igraph)
> names(dd1) <- 0:18
> barplot(dd1, cex.names = 0.8, ylim = c(0, 0.3), xlim = c(0, 60)
>            cex.axis = 0.8, xlab = 'Degrees', ylab = 'Relative  
> frequency')
>
> names(dd2) <- 0:50
> barplot(dd2, cex.names = 0.8, ylim = c(0, 0.3), xlim = c(0, 60)
>            cex.axis = 0.8, xlab = 'Degrees', ylab = 'Relative  
> frequency')

Without the data, this will remain a difficult guessing exercise. My  
guess is that you have a column that you think is numeric but is  
really a factor.


-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list