EVOLUTION-MANAGER
Edit File: breaks_log.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Breaks for log axes</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for breaks_log {scales}"><tr><td>breaks_log {scales}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Breaks for log axes</h2> <h3>Description</h3> <p>This algorithm starts by looking for integer powers of <code>base</code>. If that doesn't provide enough breaks, it then looks for additional intermediate breaks which are integer multiples of integer powers of base. If that fails (which it can for very small ranges), we fall back to <code><a href="breaks_extended.html">extended_breaks()</a></code> </p> <h3>Usage</h3> <pre> breaks_log(n = 5, base = 10) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>n</code></td> <td> <p>desired number of breaks</p> </td></tr> <tr valign="top"><td><code>base</code></td> <td> <p>base of logarithm to use</p> </td></tr> </table> <h3>Details</h3> <p>The algorithm starts by looking for a set of integer powers of <code>base</code> that cover the range of the data. If that does not generate at least <code>n - 2</code> breaks, we look for an integer between 1 and <code>base</code> that splits the interval approximately in half. For example, in the case of <code>base = 10</code>, this integer is 3 because <code>log10(3) = 0.477</code>. This leaves 2 intervals: <code>c(1, 3)</code> and <code>c(3, 10)</code>. If we still need more breaks, we look for another integer that splits the largest remaining interval (on the log-scale) approximately in half. For <code>base = 10</code>, this is 5 because <code>log10(5) = 0.699</code>. </p> <p>The generic algorithm starts with a set of integers <code>steps</code> containing only 1 and a set of candidate integers containing all integers larger than 1 and smaller than <code>base</code>. Then for each remaining candidate integer <code>x</code>, the smallest interval (on the log-scale) in the vector <code>sort(c(x, steps, base))</code> is calculated. The candidate <code>x</code> which yields the largest minimal interval is added to <code>steps</code> and removed from the candidate set. This is repeated until either a sufficient number of breaks, <code style="white-space: pre;">>= n-2</code>, are returned or all candidates have been used. </p> <h3>Examples</h3> <pre> demo_log10(c(1, 1e5)) demo_log10(c(1, 1e6)) # Request more breaks by setting n demo_log10(c(1, 1e6), breaks = breaks_log(6)) # Some tricky ranges demo_log10(c(2000, 9000)) demo_log10(c(2000, 14000)) demo_log10(c(2000, 85000), expand = c(0, 0)) # An even smaller range that requires falling back to linear breaks demo_log10(c(1800, 2000)) </pre> <hr /><div style="text-align: center;">[Package <em>scales</em> version 1.1.1 <a href="00Index.html">Index</a>]</div> </body></html>