[R] Rotating the axis labels in the basic graphic device ?
Marc Schwartz
marc_schwartz at me.com
Sat Jan 23 17:07:10 CET 2010
On Jan 23, 2010, at 9:59 AM, Uwe Ligges wrote:
>
>
> On 23.01.2010 16:56, Marc Schwartz wrote:
>> On Jan 23, 2010, at 9:51 AM, Uwe Ligges wrote:
>>
>>>
>>>
>>> On 22.01.2010 21:26, Tal Galili wrote:
>>>> Hello dear R help group,
>>>>
>>>>
>>>> I learned recently that one can change the rotation of labels in the axis,
>>>> when using a lattice plot, for example:
>>>>
>>>> library(lattice)
>>>> barchart(yield ~ variety , data = barley,
>>>> groups = year,
>>>> ylab = "Barley Yield (bushels/acre)",
>>>> scales = list(rot = 45))
>>>>
>>>> My question is: Is there an application of "rot" in something like barplot ?
>>>> The only solution I know of is using "las = X" (X is 1,2, or 3)
>>>> Is there another solution/hack for this ?
>>>
>>> No, by design there is just the "las" way ...
>>>
>>> Uwe Ligges
>>
>>
>> Actually, there is a method and it is in the R FAQs:
>>
>> http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f
>
>
> Yes you are right, Marc, thank you!
> I would not call this as "by design" and it sometimes need quite a lot fiddling if font sizes change.
>
> Best,
> Uwe
Quite right Uwe, it is not by design, but is consistent with:
library(fortunes)
fortune("yoda")
;-)
As you note, it took some understanding and tweaking of base graphics parameters and such to get that method to work.
Cheers,
Marc
More information about the R-help
mailing list