Quantcast

get plot axis rounding method

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

get plot axis rounding method

Ben quant
Hello,

Does anyone know how to get the rounding method used for the axis tick
numbers/values in plot()?

I'm using mtext() to plot the values used to plot vertical and horizontal
lines (using abline()) and I'd like these vertical and horizontal line
values to be rounded like the axis tick values are rounded.

In other words, I want numbers plotted with mtext() to be rounded in the
same fashion as the axis values given by default by plot().

thank you very much for your help!

ben

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: get plot axis rounding method

Duncan Murdoch-2
On 27/04/2012 10:55 AM, Ben quant wrote:

> Hello,
>
> Does anyone know how to get the rounding method used for the axis tick
> numbers/values in plot()?
>
> I'm using mtext() to plot the values used to plot vertical and horizontal
> lines (using abline()) and I'd like these vertical and horizontal line
> values to be rounded like the axis tick values are rounded.
>
> In other words, I want numbers plotted with mtext() to be rounded in the
> same fashion as the axis values given by default by plot().
>
> thank you very much for your help!

See ?axTicks or ?pretty.

Duncan Murdoch

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: get plot axis rounding method

Sarah Goslee
In reply to this post by Ben quant
The help for axis() talks about it some, and provides the suggestion
to see ?pretty - since you're not looking for a regular sequence of
numbers, you may need to dig into the code itself. Or something in
?axis may offer the clue you need.

But surely it's more appropriate to use the correct number of
significant figures for those data than it is to simply make them
match the axis labels?

Sarah

On Fri, Apr 27, 2012 at 10:55 AM, Ben quant <[hidden email]> wrote:

> Hello,
>
> Does anyone know how to get the rounding method used for the axis tick
> numbers/values in plot()?
>
> I'm using mtext() to plot the values used to plot vertical and horizontal
> lines (using abline()) and I'd like these vertical and horizontal line
> values to be rounded like the axis tick values are rounded.
>
> In other words, I want numbers plotted with mtext() to be rounded in the
> same fashion as the axis values given by default by plot().
>
> thank you very much for your help!
>
> ben
>


--
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
[hidden email] 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.
Loading...