I have a plot similar to the following
library(lattice)
stripplot(1:15, rep(1:3, each=5))
In order to save space for a presentation, I would like to have
horizontal strips instead of vertical. The argument 'horiz' turns the
arguments around, but not the plot. The documentation for 'stripplot'
('xyplot'), 'panel.stripplot' and the FAQ do not seem to provide
insight. Any help appreciated.
Regards, Johan
I am using R-2.4.0 on Debian Linux (details below)
version
> version
_
platform i486-pc-linux-gnu
arch i486
os linux-gnu
system i486, linux-gnu
status Patched
major 2
minor 4.0
year 2006
month 11
day 03
svn rev 39777
language R
version.string R version 2.4.0 Patched (2006-11-03
r39777)> sessionInfo()
R version 2.4.0 Patched (2006-11-03 r39777)
i486-pc-linux-gnu
locale:
LC_CTYPE=sv_SE.ISO-8859-15;LC_NUMERIC=C;LC_TIME=sv_SE.ISO-8859-15;LC_COLLATE=sv_SE.ISO-8859-15;LC_MONETARY=sv_SE.ISO-8859-15;LC_MESSAGES=sv_SE.ISO-8859-15;LC_PAPER=sv_SE.ISO-8859-15;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=sv_SE.ISO-8859-15;LC_IDENTIFICATION=C
attached base packages:
[1] "methods" "stats" "graphics"
"grDevices" "utils" "datasets"
[7] "base"
other attached packages:
lattice
"0.14-13"
--
Johan Sandblom N8, MRC, Karolinska sjh
t +46851776108 17176 Stockholm
m +46735521477 Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell
On 12/5/06, Johan Sandblom <jsandblom at gmail.com> wrote:> I have a plot similar to the following > > library(lattice) > stripplot(1:15, rep(1:3, each=5))That doesn't look like a meaningful call. Did you mean something like stripplot(1:15 ~ rep(1:3, each=5)) ? In any case, the 'horiz(ontal)' argument is meant for unusual situations, you shouldn't need to use it. One of the variables in a strip plot is supposed to be a categorical variable, and categorical variables are represented by factors in R. Instead of using numeric variables as in your example, use factors, and you should be fine. For example, this gives me horizontal strip plots: stripplot(factor(rep(1:3, each=5)) ~ 1:15) and this vertical: stripplot(1:15 ~ factor(rep(1:3, each=5)))> In order to save space for a presentation, I would like to have > horizontal strips instead of vertical. The argument 'horiz' turns the > arguments around, but not the plot. The documentation for 'stripplot' > ('xyplot'), 'panel.stripplot' and the FAQ do not seem to provide > insight. Any help appreciated.The documentation for 'stripplot' says: ... In the other four functions documented here, exactly one of 'x' and 'y' should be numeric, and the other a factor or shingle. Which of these will happen is determined by the 'horizontal' argument - if 'horizontal=TRUE', then 'y' will be coerced to be a factor or shingle, otherwise 'x'. The default value of 'horizontal' is 'FALSE' if 'x' is a factor or shingle, 'TRUE' otherwise. which part is unclear? -Deepayan