[英]R barplot not showing xlab
I am using igraph
and I want to plot the degree distribution of a graph. 我正在使用igraph
,我想绘制图形的度分布。 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. 我得到这张照片,但是x轴上的数字丢失了。
Answer's in the barplot documentation ( ?barplot
). 条形文档( ?barplot
)中的答案。 Just add names.arg = 1:20
to your barplot. 只需将names.arg = 1:20
添加到您的barplot中即可。 You can decrease cex.names
slightly to allow all items to be displayed. 您可以稍微减少cex.names
以显示所有项目。
barplot(abs(rnorm(20)), names.arg=1:20, xlab='Degree', cex.names=0.8)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.