[R] help on plot on the log scale but showing original values on axis
Michael Weylandt
michael.weylandt at gmail.com
Thu Aug 30 18:37:52 CEST 2012
Possibly easier: plot(x, y, log = "x")
Cheers,
Michael
On Aug 30, 2012, at 5:47 AM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> Hello,
>
> The following is the general idea.
>
> x <-c(0.25,0.5,1,2,4,8,16,32)
> y <-c(1,1,1,1,0.9,0.8,0.6,0.2)
>
> plot(log(x),y,type="b", xaxt = "n")
> axis(1, at = log(x), labels = x)
>
> If the x values are not so "neat", you can adjust the axis ticks and
> labels using round/seq.
>
> Hope this helps,
>
> Rui Barradas
>
> Em 30-08-2012 11:12, Andras Farkas escreveu:
>> dear All
>>
>> I am trying to plot the following with the x axis on the log scale, but I would like the original x values to show up as labels:
>>
>> x <-c(0.25,0.5,1,2,4,8,16,32)
>> y <-c(1,1,1,1,0.9,0.8,0.6,0.2)
>>
>> plot(log(x),y,type="b")
>>
>> here I would like the labels 0.25,0.5,1,2,4,8,16, and 32 to show on the plot at their respective "log scale" location
>>
>> apreciate the help,
>>
>>
>> Andras
>> [[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.
>
>
> [[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.
More information about the R-help
mailing list