문제

I am using igraph and I want to plot the degree distribution of a graph. Here is an example:

full <- graph.full(20, directed=FALSE)
full_deg = degree.distribution(full)
barplot(full_deg, main='Full graph', xlab='Degree')

I get this picture, but the numbers from the x axis are missing.

r plot

도움이 되었습니까?

해결책

Answer's in the barplot documentation (?barplot). Just add names.arg = 1:20 to your barplot. You can decrease cex.names slightly to allow all items to be displayed.

barplot(abs(rnorm(20)), names.arg=1:20, xlab='Degree', cex.names=0.8)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top