直方图 x/y 标签未显示

Histogram x/y labels aren't displayed

我已经在 R 上上传了一个网络,并且计算了出度和入度中心性。现在,我想使用 hist() 使用这些元素制作两个直方图,但我无法更改图表的 x/y 标签我不知道为什么!谁能帮我? :)

这是数据:

structure(list(owner = c("ABBA JEANS MINING Sprl", "ABBA JEANS MINING Sprl", "ACACIA Sprl", "ACACIA Sprl", "ACACIA Sprl", "ACACIA Sprl", "AFRICAN ENGINEERING CORPORATE Sprl",  "AFRICAN ENGINEERING CORPORATE Sprl", "AFRICAN ENGINEERING CORPORATE Sprl",  "AFRICAN MINERALS (Barbados) Ltd Sprl"), armed_band = c("Mayi Mayi Militia (Bakata Katanga)",  "Militia (Elements)", "Batwa Ethnic Militia", "FDD", "Militia (Kamwina Nsapu)",  "RCD-Goma", "Anti-Balaka", "Kuluna Communal Militia", "Militia (Kamwina Nsapu)",  "Mayi Mayi Militia (Bakata Katanga)"), freq = c(1, 1, 1, 1, 4,  1, 1, 1, 1, 1)), row.names = c(NA, -10L), class = c("tbl_df",  "tbl", "data.frame"))

这是我使用的代码:

all_network=network(data_network,matrix.type="edgelist",directed=TRUE) 
InDegree <- degree(all_network, cmode="indegree")     
OutDegree <- degree(all_network, cmode="outdegree")   
par(mar = rep(2, 4))
par(mfrow=c(1,2)) 
hist(InDegree, 
 xlab="YYY", 
 main="Number", 
 ylab="Frequency", 
 col="grey",
 breaks = c(1*0:200),
 xlim = range(1:40),
 freq=FALSE, 
 )
hist(OutDegree, 
 main="XXX", 
 xlab='Number', 
 freq=FALSE, 
 ylab="Frequency", 
 col="lightblue",
 xlim = range(1:40),
 breaks = c(1*0:40),
 )
par(mfrow=c(1,1)) 

非常感谢!

您设置的边距太小,标签无法显示。

# This causes the problem
par(mar = rep(2, 4))
# Reset par to default
dev.off()
par(mar = c(5.1, 4.1, 4.1, 2.1))
par(mfrow=c(1,2)) 
hist(InDegree, 
     main="Number", 
      xlab="YYY", 
     
     ylab="Frequency", 
     col="grey",
     breaks = c(1*0:200),
     xlim = range(1:40),
     freq=T, 
)


hist(OutDegree, 
     main="XXX", 
     xlab='Number', 
     freq=T, 
     ylab="Frequency", 
     col="lightblue",
     xlim = range(1:40),
     breaks = c(1*0:40),
)