Skip to content

What is the ggplot analog of the axis() function?

3 messages · Rui Barradas, Patrick Connolly

#
Using base R graphics I can customize the position of the tick marks and 
what text to label them by using the axis function and adjusting the 
`at` and `labels` parameters respectively.

What theme setting do I adjust using ggplot2 graphics to achieve a 
similar result?

TIA

Patrick
#
Hello,

In ggplot2, to set the placement and labels of the axis use

?scale_x_continuous
?scale_y_continuous

and similar functions. The arguments you would want are 'breaks' and 
'labels'.

Then you can further customize with ?theme. Arguments such as axis.text 
or axis.ticks are what you would use.

This is a (very) broad question, if you have doubts in something more 
specific, say so.

Hope this helps,

Rui Barradas

?s 20:35 de 16/02/20, p_connolly escreveu:
#
Thanks Rui,

I had looked at the scale_continuous functions and found the help 
overwhelming.  But thanks for the information:  `labels` works the same 
as it does in axis() and `breaks` is what I needed to correspond to the 
`at` argument.

Regards
Patrick
On 2020-02-17 11:31, Rui Barradas wrote: