Skip to content
Back to formatted view

Raw Message

Message-ID: <11252F8C-F3A8-4CC3-92A9-C22293AF8BA9@gmail.com>
Date: 2012-08-30T16:37:52Z
From: R. Michael Weylandt
Subject: help on plot on the log scale but showing original values on axis
In-Reply-To: <503F44CE.8050404@sapo.pt>

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.