Hi, everyone: I am plotting an graph with bar plot, but the label after every bar is too long, I wanna if I can draw the label lean to an angle thanks -- Xiaogang Yang Sensorweb Research Laboratory http://sensorweb.vancouver.wsu.edu/ Washington State University Vancouver [[alternative HTML version deleted]]
On Sep 7, 2009, at 5:03 PM, Xiaogang Yang wrote:> Hi, everyone: > I am plotting an graph with bar plot, but the label after every bar > is too > long, I wanna if I can draw the label lean to an angle > thanksIt depends on the particular function and "bar plot" is insufficiently specified to be .... specific. If it's a Lattice function, you should be looking at the rot (sub) parameter within the scales parameters. If it's a graphics function, you could try looking at the las parameter to par(). -- David Winsemius, MD Heritage Laboratories West Hartford, CT
#Example data
df <- data.frame(trt = factor(c("A long label", "Another long
\n label")),
outcome = c(1,4))
#Install ggplot2 if needed
library(ggplot2)
p <- ggplot(df, aes(y=outcome, x=trt))
p <- p + geom_bar(position="dodge", stat="identity")
p <- p + opts(axis.text.x = theme_text(angle = 45, hjust=1))
p
On Mon, Sep 7, 2009 at 5:03 PM, Xiaogang Yang <gavinxyang@gmail.com>
wrote:
> Hi, everyone:
> I am plotting an graph with bar plot, but the label after every bar is too
> long, I wanna if I can draw the label lean to an angle
> thanks
>
> --
> Xiaogang Yang
> Sensorweb Research Laboratory
> http://sensorweb.vancouver.wsu.edu/
> Washington State University Vancouver
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
par(xpd=T)
bp<- barplot(matrix(1:50,5,10),names=F)
text(bp,-2,c('these labels','are
tooo','looong'),pos=2,srt=45)
Xiaogang Yang wrote:>
> Hi, everyone:
> I am plotting an graph with bar plot, but the label after every bar is too
> long, I wanna if I can draw the label lean to an angle
> thanks
>
> --
> Xiaogang Yang
> Sensorweb Research Laboratory
> http://sensorweb.vancouver.wsu.edu/
> Washington State University Vancouver
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context:
http://www.nabble.com/lean-text-label-below-barplot-table-tp25336287p25426596.html
Sent from the R help mailing list archive at Nabble.com.