[R] Adjusting axis limits in ggplot2.

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Sat Jun 20 05:57:55 CEST 2020


?scale_x_discrete, in particular the expand argument.

On June 19, 2020 7:07:32 PM PDT, Rolf Turner <r.turner using auckland.ac.nz> wrote:
>
>I'm having trouble adjusting axis limits in ggplot2 when the variable
>corresponding to that axis is a factor.  I have attached a minimal
>reproducible example in the file demo.txt.
>
>The result (see it by sourcing demo.txt and printing ldCiPlot) is fine
>except that I would like the y-axis limits to be 0 and 7 rather than
>0.5 and 6.5.
>
>I tried adding xlim(0,7) ("x" because I do a coord_flip()) but this 
>causes the error
>
>> Error: Discrete value supplied to continuous scale
>
>to be thrown.  I have Googled around quite a bit and have not managed
>to 
>find anything useful that I can understand.  I'm sure there is a simple
>solution, but I can't find it.  Can anyone point me in the right 
>direction?  Ta.
>
>cheers,
>
>Rolf Turner

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list