You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Let’s first create a simple scatter plot to illustrate the problems. The <code>diamonds</code> dataset has 53940 observations. If stored into a vectorized graphics device such as <code>pdf()</code> or <code>svg()</code>, the file will be large (each observation is individually represented as graphic elements) and slow to open or arrange. Furthermore, the high number of data points leads to saturation and we do not see the full underlying density of data points.</p>
3182
3182
<div class="cell">
3183
3183
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># create base plot</span></span>
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="co"># ... with marginal density plots by number of cylinders</span></span>
<p>The linear contour levels or color intervals (controlled by <code>bins</code> or <code>breaks</code>) may not work well in a case like ours, where the density is very high in some regions that will occupy almost the complete color scale and we lose resoulution in low density regions. You can use <code>breaks</code> to create non-linear intervals (here combined with <code>ndensity</code> so that we know the range of densities: [0, 1]) and with <code>theme(panel.background)</code> to make the zero-density area dark blue.</p>
3230
+
<p>The linear contour levels or color intervals (controlled by <code>bins</code> or <code>breaks</code>) may not work well in a case like ours, where the density is very high in some regions that will occupy almost the complete color scale and we lose resolution in low density regions. You can use <code>breaks</code> to create non-linear intervals (here combined with <code>ndensity</code> so that we know the range of densities: [0, 1]) and with <code>theme(panel.background)</code> to make the zero-density area dark blue.</p>
3231
3231
<div class="cell">
3232
3232
<details class="code-fold">
3233
3233
<summary>Code</summary>
3234
3234
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co"># ... with marginal density plots by number of cylinders</span></span>
0 commit comments