Re: [R] Label Rotation when Plotting with Factors

From: jim holtman <jholtman_at_gmail.com>
Date: Sun, 27 Apr 2008 20:55:56 -0400

Is this what you want:

city <- factor(c("denver", 'cincy', 'chicago','nyc')) par(mar=c(8,4,1,1)) # enough margin on x-axis plot(city, 1:4, xaxt='n')
axis(1, at=as.numeric(city),labels=city, las=2)

On Sun, Apr 27, 2008 at 8:15 PM, <mwittmann_at_bren.ucsb.edu> wrote:
> Hello,
>
> Sorry if this is a repeat, having trouble finding what I need on archive and am
> a novice with graphics in R!
>
> I have plotted the results of a logit regression by factor, where "city" is the
> factor set name. The problem is city names are too long and I need to rotate
> them 90 degrees along the xaxis. This is what I've tried...
>
> plot(city, predicted.probability, xlab = "city"...)
> axis(1,las = 2)
>
> This does not affect the existing labels.
>
> I have also tried (axes=FALSE), and then rename new with (labels = "Denver",
> etc. ), but it seems as though I need to maintain the factor identities, as it
> give me the error: 'labels' is supplied and not 'at'
>
> Any suggestions?
>
> Thank you,
>
> marion wittmann
>
> ______________________________________________
> 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
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.
Received on Mon 28 Apr 2008 - 01:00:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 Apr 2008 - 04:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive