Re: [R] padding bug in lattice/levelplot

2008-10-17 Thread Paul Boutros
Thanks for the rapid response Deepayan -- that's what I was looking  
for.  Thanks also for your ongoing support of lattice, it's very much  
appreciated!

Paul

Quoting Deepayan Sarkar [EMAIL PROTECTED]:


On 10/16/08, Paul Boutros [EMAIL PROTECTED] wrote:

Hello,

 I have encountered some unexpected behaviour with levelplot that may simply
be a misunderstanding on my part.

 If I create a levelplot from a matrix with named columns, some padding
space appears at the top and bottom of the heatmap.  Here is an   
example, [...]


This is because the named columns get treated as a factor, and cause
the corresponding axis annotation code to be triggered. This isn't
easy to fix without major changes. A simple workaround is to change
the padding for factors in the call to levelplot:

levelplot(data, lattice.options = list(axis.padding = list(factor = 0.5)))

It may make sense for this to happen by default; I'll check if that
has any potential drawbacks.

-Deepayan



__
R-help@r-project.org 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.


[R] padding bug in lattice/levelplot

2008-10-16 Thread Paul Boutros

Hello,

I have encountered some unexpected behaviour with levelplot that may  
simply be a misunderstanding on my part.


If I create a levelplot from a matrix with named columns, some  
padding space appears at the top and bottom of the heatmap.  Here is  
an example, and I've used panel.fill to make the space I'm speaking of  
evident (in green).


##
library(lattice);
library(latticeExtra);

data - matrix(
nrow = 5,
ncol = 2,
data = rnorm(10)
);
colnames(data) - c(Col1, Col2);

levelplot(
data,
panel = function(...) {
panel.fill(col = green)
panel.levelplot(...);
},
aspect = fill,
scales = list(
x = list(
labels = NULL,
tck = c(0,0)
),
y = list(
cex = 3
)
),
xlab = '',
ylab = ''
);
##

If I now remove the column names and run the same code, this padding  
space disappears.


##
colnames(data) - NULL;

levelplot(
data,
panel = function(...) {
panel.fill(col = green)
panel.levelplot(...);
},
aspect = fill,
scales = list(
x = list(
labels = NULL,
tck = c(0,0)
),
y = list(
cex = 3
)
),
xlab = '',
ylab = ''
);
##

I am looking to create a levelplot that uses the entire area (like the  
second example) but that has labeled rows (like the first).  I'm very  
confused about what's causing this padding, or where to look to remove  
it.  I attempted:

scale = list(x = list(axs = r), y = list(axs = r))
and that did not alter things.

Here is my system information:


sessionInfo();

R version 2.7.2 (2008-08-25)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United  
States.1252;LC_MONETARY=English_United  
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252


attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] latticeExtra_0.5-2 RColorBrewer_1.0-2 lattice_0.17-15

loaded via a namespace (and not attached):
[1] grid_2.7.2

Any help/suggestions are very much appreciated,
Paul

__
R-help@r-project.org 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.


Re: [R] padding bug in lattice/levelplot

2008-10-16 Thread Deepayan Sarkar
On 10/16/08, Paul Boutros [EMAIL PROTECTED] wrote:
 Hello,

  I have encountered some unexpected behaviour with levelplot that may simply
 be a misunderstanding on my part.

  If I create a levelplot from a matrix with named columns, some padding
 space appears at the top and bottom of the heatmap.  Here is an example, [...]

This is because the named columns get treated as a factor, and cause
the corresponding axis annotation code to be triggered. This isn't
easy to fix without major changes. A simple workaround is to change
the padding for factors in the call to levelplot:

levelplot(data, lattice.options = list(axis.padding = list(factor = 0.5)))

It may make sense for this to happen by default; I'll check if that
has any potential drawbacks.

-Deepayan

__
R-help@r-project.org 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.