Pio
Pio

Reputation: 4062

R barplot not showing xlab

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

Upvotes: 1

Views: 3415

Answers (1)

koekenbakker
koekenbakker

Reputation: 3604

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)

Upvotes: 2

Related Questions