[R] mosaic plot of vcd package does not stretch with 2-dimension?

2008-05-02 Thread Sang Chul Choi

Hi,

I like mosaic function of vcd package. I have played around it. I  
have found out that mosaic plot  data table is 2-dimension does not  
stretch when you enlarge a mosaic plot. It is okay when data table is  
3 or more dimension. The first one is of 3-dimension table case, and  
the second one is 2-dimension. With the first plot, you can drag  
window to enlarge a plot. With the second, I cannot.


I have gone through the document, but I could not find any specific to  
solve this problem.


Thank you,

Sang Chul

===
music = c(210, 194, 170, 110,
  190, 406, 730, 290)
dim(music) = c(2, 2, 2)
dimnames(music) = list(Age = c(Old, Young),
   Education = c(High, Low),
   Listen = c(Yes, No))
mosaic(music)
===

===
music = c(210, 194, 170, 110,
  190, 406, 730, 290)
dim(music) = c(2, 4)
dimnames(music) = list(Age = c(Old, Young),
   Education = c(High, Low, Upper, Lower))
mosaic(music)

__
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] mosaic plot of vcd package does not stretch with 2-dimension?

2008-05-02 Thread Achim Zeileis
On Fri, 2 May 2008, Sang Chul Choi wrote:

 Hi,

 I like mosaic function of vcd package. I have played around it. I
 have found out that mosaic plot  data table is 2-dimension does not
 stretch when you enlarge a mosaic plot. It is okay when data table is
 3 or more dimension. The first one is of 3-dimension table case, and
 the second one is 2-dimension. With the first plot, you can drag
 window to enlarge a plot. With the second, I cannot.

You need to set
  keep_aspect_ratio = FALSE
This is described on the man page for strucplot() (which is the workhorse
function behind mosaic()):

keep_aspect_ratio: logical indicating whether the aspect ratio should
  be fixed or not. If unspecified, the default is 'TRUE' for
  two-dimensional tables and 'FALSE' otherwise.

hth,
Z

 I have gone through the document, but I could not find any specific to
 solve this problem.

 Thank you,

 Sang Chul

 ===
 music = c(210, 194, 170, 110,
190, 406, 730, 290)
 dim(music) = c(2, 2, 2)
 dimnames(music) = list(Age = c(Old, Young),
 Education = c(High, Low),
 Listen = c(Yes, No))
 mosaic(music)
 ===

 ===
 music = c(210, 194, 170, 110,
190, 406, 730, 290)
 dim(music) = c(2, 4)
 dimnames(music) = list(Age = c(Old, Young),
 Education = c(High, Low, Upper, Lower))
 mosaic(music)

 __
 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-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] mosaic plot of vcd package does not stretch with 2-dimension?

2008-05-02 Thread Dieter Menne
Sang Chul Choi choi at biology.rutgers.edu writes:
 I like mosaic function of vcd package. I have played around it. I  
 have found out that mosaic plot  data table is 2-dimension does not  
 stretch when you enlarge a mosaic plot. It is okay when data table is  
 3 or more dimension. The first one is of 3-dimension table case, and  
 the second one is 2-dimension. With the first plot, you can drag  
 window to enlarge a plot. With the second, I cannot.
 
 
 ===
 music = c(210, 194, 170, 110,
190, 406, 730, 290)
 dim(music) = c(2, 2, 2)
 dimnames(music) = list(Age = c(Old, Young),
 Education = c(High, Low),
 Listen = c(Yes, No))
 mosaic(music)
 ===
 
 ===
 music = c(210, 194, 170, 110,
190, 406, 730, 290)
 dim(music) = c(2, 4)
 dimnames(music) = list(Age = c(Old, Young),
 Education = c(High, Low, Upper, Lower))
 mosaic(music)

Not really: note that the images resizes correctly, it just keeps its square
aspect-ratio.

vcd is so strongly modularized that it can be difficult to find the information
required. Check strucplot, where it says:

strucplot
keep_aspect_ratio   logical indicating whether the aspect ratio should be
fixed or not. If unspecified, the default is TRUE for two-dimensional tables and
FALSE otherwise.

So try

mosaic(music, keep_aspect_ratio=FALSE)

but think over if that's really what you want. In most cases it makes 
sense to keep the square aspect for 2x2 cases 

Dieter

__
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] mosaic plot of vcd package does not stretch with 2-dimension?

2008-05-02 Thread Sang Chul Choi

Thank you very much!

Sang Chul

On May 2, 2008, at 12:06 PM, Dieter Menne wrote:


Sang Chul Choi choi at biology.rutgers.edu writes:

I like mosaic function of vcd package. I have played around it. I
have found out that mosaic plot  data table is 2-dimension does not
stretch when you enlarge a mosaic plot. It is okay when data table is
3 or more dimension. The first one is of 3-dimension table case, and
the second one is 2-dimension. With the first plot, you can drag
window to enlarge a plot. With the second, I cannot.




===
music = c(210, 194, 170, 110,
  190, 406, 730, 290)
dim(music) = c(2, 2, 2)
dimnames(music) = list(Age = c(Old, Young),
   Education = c(High, Low),
   Listen = c(Yes, No))
mosaic(music)
===

===
music = c(210, 194, 170, 110,
  190, 406, 730, 290)
dim(music) = c(2, 4)
dimnames(music) = list(Age = c(Old, Young),
   Education = c(High, Low, Upper,  
Lower))

mosaic(music)


Not really: note that the images resizes correctly, it just keeps  
its square

aspect-ratio.

vcd is so strongly modularized that it can be difficult to find the  
information

required. Check strucplot, where it says:

strucplot
keep_aspect_ratio   logical indicating whether the aspect ratio  
should be
fixed or not. If unspecified, the default is TRUE for two- 
dimensional tables and

FALSE otherwise.

So try

mosaic(music, keep_aspect_ratio=FALSE)

but think over if that's really what you want. In most cases it makes
sense to keep the square aspect for 2x2 cases

Dieter

__
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-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.