我使用以下CSV代码获取以下代码
library(ggpubr)
library(ggsci)
df = read.csv2("file.csv",row.names=1)
# Copy df
df2 = df
# Convert the cyl variable to a factor
df2$perc <- as.factor(df2$perc)
# Add the name colums
df2$name <- rownames(df)
ggbarplot(df2,x = "name",y = "perc",fill = "role",# change fill color by cyl
color = "white",# Set bar border colors to white
palette = "npg",# jco journal color palett. see ?ggpar
sort.val = "asc",# Sort the value in dscending order
sort.by.groups = FALSE,# Don't sort inside each group
x.text.angle = 0,# Rotate vertically x axis texts
rotate = TRUE,label = TRUE,label.pos = "out",#label = TRUE,lab.pos = "in",lab.col = "white",width = 0.5
)
CSV为:
genes;perc;role
GATA-3;7,9;confirmed in this cancer
ccdC74A;6,8;prognostic in this cancer
LINC00621;6,1;none
POLRMTP1;4,1;none
IGF2BP3;3,2;confirmed in this cancer
产生了这个情节
我在这里没有两件事:
1)为什么每个条的x轴刻度都与绘制的实际值相对应?我的意思是为什么x轴不是从0到8,我认为应该如此。我希望我能正确解释。
2)标签值似乎与y厚度不对齐。我在这里缺少选项吗?