R: How can I make a barplot with labels parallel (horizontal) to bars

后端 未结 2 1361
挽巷
挽巷 2021-02-05 05:18

In barplot, is it possible to make the labels parallel to the bars?

Suppose we have the data frame called \"data\".

              Page   PV UniquePgv
1 /         


        
相关标签:
2条回答
  • 2021-02-05 05:53

    You can use the las graphics parameter. However, if you do that, the names will run off the end of the window, so you need to change the margins. For example:

    par(mai=c(1,2,1,1))
    barplot(data$PV,main="Page Views", horiz=TRUE,names.arg=names,las=1)
    

    enter image description here

    0 讨论(0)
  • 2021-02-05 06:09

    enter image description here

    enter image description hereng

    esal = c(res$V3)

    ename = res$V2 barplot(esal, names.arg=ename, col=c(rainbow(length(esal))), xlab="Employee Name", ylab="Salary", main="Emp V/S Salary")

    0 讨论(0)
提交回复
热议问题