在某些图中没有显示x轴标签(堆积条形图)

问题描述 投票:0回答:1

我正在设计一个带有多个图的工作表,但对于只有一个条的所有条形图,未显示x轴标签。如何在所有图中显示轴标签?

这是我的结果:

这是我的代码:

library(utils)
library(RColorBrewer)
library(readr)
library(readxl)
rm(list=ls())

color <- brewer.pal(6,"Spectral")
overlap <- read_excel("overlap.xlsx")
par(mar=c(3,3,1,1),mgp=c(2,0.9,0),xaxs="i", yaxs="i")


overlap.dat <- overlap[overlap$`Countries and areas`=="Pakistan",]
overlap.dat <- t(overlap.dat)
colnames(overlap.dat) = overlap.dat[5,]
overlap.dat <- as.matrix(overlap.dat[-c(1:8,14),])

barplot(overlap.dat, main = "Pakistan", col = color, ylim = c(0,100), xlim = c(0, 8),
        cex.names = 0.8, names.arg = colnames(overlap.dat), legend = TRUE, 
        args.legend = list(x = "topright", y = 100, cex = 0.8, bty = "n"), las = 2 )
r bar-chart axis-labels
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.