Note that there are some explanatory texts on larger screens.

plurals
  1. POR: Levelplot gives extraneous whitespace when range of row.values and column.values is small
    primarykey
    data
    text
    <p>When using the levelplot (from lattice package) in R, I noticed that there is extra whitespace around the edges of the graph if the range of column.values and row.values is small (e.g range is less than 1). This problem disappears if the range of column.values and row.values is bigger (e.g. range is 10). </p> <p>Here's an example that illustrates the problem:</p> <pre><code>library(gplots) # for colorpanel() library(lattice) # for levelplot() #generate data myData = runif(100) #generate vector of 100 random numbers myMatrix=matrix(myData, sqrt(length(myData)), sqrt(length(myData))) #generate vectors that will be used for col.values and row.values labelIncrement= 1/10 labelLow = -0.5 labelHigh = 0.5 - labelIncrement dataForRow.values &lt;- c(seq(labelLow, labelHigh, labelIncrement)) dataForColumn.values &lt;- c(seq(labelLow, labelHigh, labelIncrement)) myLevelsArbitrary &lt;- c(0, 0.2, 0.4, 0.6, 0.8, 1.0) myColors = topo.colors(length(myLevelsArbitrary)+1) myLevelPlot = levelplot(myMatrix, at=myLevelsArbitrary, col.regions=myColors, column.values=dataForColumn.values, row.values=dataForRow.values, main="Title", xlab="Distance from center (cm)", ylab="Distance from center (cm)", colorkey=list(width=3)) plot(myLevelPlot) </code></pre> <p><strong><a href="http://i.imgur.com/VmTS1.png" rel="nofollow">This image</a> is myLevelPlot.</strong></p> <p>Now, let's tweak the above code to have a bigger range for row.values and column.values:</p> <pre><code>labelIncrement= 1 labelLow = -5 labelHigh = 5 - labelIncrement </code></pre> <p><strong><a href="http://i.imgur.com/1uEWg.png" rel="nofollow">This myLevelPlot image</a> was generated by re-running the code with the bigger range of row.values and column.values.</strong> Notice that the extraneous whitespace does not occur in the following image.</p> <p>So, how do I avoid having this extraneous whitespace when I have a small range for row.values and column.values? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload