Re: [R] x-axis tick marks on log scale plot

2016-05-20 Thread Robert Baer
Very, very nice.  Thanks for sharing.


On 5/20/2016 4:21 AM, Martin Maechler wrote:
>> Brian Smith 
>>  on Thu, 19 May 2016 11:04:55 -0400 writes:
>  > Thanks all !!  On Thu, May 19, 2016 at 9:55 AM, Ivan
>  > Calandra  wrote:
>
>  >> Hi,
>  >>
>  >> You can do it by first plotting your values without the
>  >> x-axis: plot(x,y,log="xy", xaxt="n")
>  >>
>  >> and then plotting the x-axis with ticks where you need to:
>  >> axis(side=1, at=seq(2000,8000,1000))
>
> Getting nicer looking axis ticks  for log-scale axes (and
> traditional graphics) I have created the function
> eaxis()
> and utility functionpretty10exp(.)
>
> and I also created standard R's  axTicks(.)  to help with these.
>
>  if(!require("sfsmisc")) install.packages("sfsmisc")
>  require("sfsmisc")
>
>  x <- lseq(1e-10, 0.1, length = 201)
>  plot(x, pt(x, df=3), type = "l", xaxt = "n", log = "x")
>  eaxis(1)
>
> gives the attached plot
>
>
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] x-axis tick marks on log scale plot

2016-05-20 Thread Martin Maechler
> Brian Smith 
> on Thu, 19 May 2016 11:04:55 -0400 writes:

> Thanks all !!  On Thu, May 19, 2016 at 9:55 AM, Ivan
> Calandra  wrote:

>> Hi,
>> 
>> You can do it by first plotting your values without the
>> x-axis: plot(x,y,log="xy", xaxt="n")
>> 
>> and then plotting the x-axis with ticks where you need to:
>> axis(side=1, at=seq(2000,8000,1000))

Getting nicer looking axis ticks  for log-scale axes (and
traditional graphics) I have created the function
   eaxis()
and utility functionpretty10exp(.)

and I also created standard R's  axTicks(.)  to help with these.

if(!require("sfsmisc")) install.packages("sfsmisc")
require("sfsmisc")

x <- lseq(1e-10, 0.1, length = 201)
plot(x, pt(x, df=3), type = "l", xaxt = "n", log = "x")
eaxis(1)

gives the attached plot



eaxis-log-example.pdf
Description: Adobe PDF document
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Re: [R] x-axis tick marks on log scale plot

2016-05-19 Thread Brian Smith
Thanks all !!

On Thu, May 19, 2016 at 9:55 AM, Ivan Calandra 
wrote:

> Hi,
>
> You can do it by first plotting your values without the x-axis:
> plot(x,y,log="xy", xaxt="n")
>
> and then plotting the x-axis with ticks where you need to:
> axis(side=1, at=seq(2000,8000,1000))
>
> HTH,
> Ivan
>
> --
> Ivan Calandra, PhD
> Scientific Mediator
> University of Reims Champagne-Ardenne
> GEGENAA - EA 3795
> CREA - 2 esplanade Roland Garros
> 51100 Reims, France
> +33(0)3 26 77 36 89
> ivan.calan...@univ-reims.fr
> --
> https://www.researchgate.net/profile/Ivan_Calandra
> https://publons.com/author/705639/
>
>
> Le 19/05/2016 à 15:40, Brian Smith a écrit :
>
>> Hi,
>>
>> I have a plot with log scale on the axes. How do I add ticks and labels in
>> addition to the ones provided by default? Can I specify where I want the
>> ticks and labels?
>>
>> For example:
>>
>> set.seed(12345)
>> x <- sample(1:1,10)
>> y <- sample(1:1,10)
>>
>> plot(x,y,log="xy")
>>
>>
>> For me, this plot has tick marks (and labels) at 2000, 4000, 6000, 8000.
>> How can I make the axes so that it has marks and labels at 1000 intervals
>> (i.e. 2000, 3000, 4000, etc.)
>>
>> thanks!
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>>
>>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Re: [R] x-axis tick marks on log scale plot

2016-05-19 Thread Ivan Calandra

Hi,

You can do it by first plotting your values without the x-axis:
plot(x,y,log="xy", xaxt="n")

and then plotting the x-axis with ticks where you need to:
axis(side=1, at=seq(2000,8000,1000))

HTH,
Ivan

--
Ivan Calandra, PhD
Scientific Mediator
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 19/05/2016 à 15:40, Brian Smith a écrit :

Hi,

I have a plot with log scale on the axes. How do I add ticks and labels in
addition to the ones provided by default? Can I specify where I want the
ticks and labels?

For example:

set.seed(12345)
x <- sample(1:1,10)
y <- sample(1:1,10)

plot(x,y,log="xy")


For me, this plot has tick marks (and labels) at 2000, 4000, 6000, 8000.
How can I make the axes so that it has marks and labels at 1000 intervals
(i.e. 2000, 3000, 4000, etc.)

thanks!

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] x-axis tick marks on log scale plot

2016-05-19 Thread Duncan Murdoch

On 19/05/2016 9:40 AM, Brian Smith wrote:

Hi,

I have a plot with log scale on the axes. How do I add ticks and labels in
addition to the ones provided by default? Can I specify where I want the
ticks and labels?

For example:

set.seed(12345)
x <- sample(1:1,10)
y <- sample(1:1,10)

plot(x,y,log="xy")


For me, this plot has tick marks (and labels) at 2000, 4000, 6000, 8000.
How can I make the axes so that it has marks and labels at 1000 intervals
(i.e. 2000, 3000, 4000, etc.)


You'll get ticks on side 1 (the x axis) by using

axis(1, at=1000*(2:10))

You'll get labels at some of those locations; R will leave some out, if 
it looks as though the labels will overlap.  Using las=2 will make them 
perpendicular to the axis, and all should be drawn.


Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.