Skip to content

Finding different hues for a mosaic plot compatible with grayscale printing

5 messages · Jim Lemon, Simon Kiss, Achim Zeileis

#
I'm working with the following code below to generate a
how do I set the h,c, and l values such that the significant, positive  
residuals appear different on a grayscale printer from significant  
grayscale residuals.  The challenge as I see it is that one can only  
distinguish the positive and negative residuals with the hue/. Varying  
the chroma and the luminance only affect the distinctions between  
large and small and significant and non significant.  But my positive  
and negative residuals are both large (absolutely) and significant,  
meaning that they will have the same chroma and luminosity, but  
different hues.
I guess the key here is to find two separate hue values that appear  
substantially different *on a grayscale printer* at the same chroma  
and luminance. I have read through Zeileis et al. (2007, 2008) but  
can't quite find the answer there.
I have also tried the Friendly shading to vary the line type, but I  
can't find line types that are different enough to communicate the  
difference between positive and negative residuals clearly.

Your assistance is appreciated.

 >mosaic(~educ+trade_off_scaled, shade=TRUE, main="Support For  
Environmental Protection At The Expense of Creating Jobs By  
Education", gp=shading_hcl(CST17$observed, CST17$expected, ASR17,  
df=6, h=c(260,0), c=c(100,0), l=c(90,0)),  
labeling_args=list(rot_labels=c(25,90,0,0), offset_labels=c(1,0,0,2),  
offset_varnames=c(2,0,0,4),  
set_varnames=c(trade_off_scaled="Protecting The Environment Is More  
Important Than Creating Jobs", educ="Level of Education")))

*********************************
Simon J. Kiss, PhD
SSHRC and DAAD Post-Doctoral Fellow
John F. Kennedy Institute of North America Studies
Free University of Berlin
Lansstra?e 7-9
14195 Berlin, Germany
Cell: +49 (0)1525-300-2812,
Web: http://www.jfki.fu-berlin.de/index.html
#
On 05/12/2010 07:34 PM, Simon Kiss wrote:
Hi Simon,
I thought that the symbolbox function might do something useful, but it 
required a bit of modification. The attached mod allows the user to fill 
a rectangle with symbols, which includes things like "+" and "-".

Jim

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: symbolbox.R
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100512/e4828caf/attachment.pl>
#
Dear Colleagues,
Thanks for that JIm, but It strikes me that printing the residual  
values in the cells might be a simpler way of communicating the  
direction of each cell.
I can get the residuals printed via the labeling_values commands in  
mosaic, but I cannot seem to *combine* this with labeling_borders  
commands that I'd like to use to modify the rotation, font size and  
contents of variable names and labels.
The following mosaic command draws the plot with the labeling I'd like.

 >mosaic(~social_class+ctax_agg_scaled, pop=FALSE, shade=TRUE,  
main="The Liberals Carbon Tax Or Green Shift Would Hurt The Canadian  
Economy By EGP Class Category", main_gp=gpar(fontsize=16),  
gp=shading_hcl(CST21$observed, CST21$expected, ASR21, df=12,  
h=c(260,0), c=c(100,0), l=c(90,50), interpolate=c(1,2,3,4)),  
labeling_args=list(labels=TRUE, rot_labels=c(25,0,0,25),  
gp_labels=gpar(fontsize=7), just_labels="center",  
offset_labels=c(1,0,0,4), offset_varnames=c(2,0,0,4),  
set_varnames=c(ctax_agg_scaled="The Liberal Green Shift Or Carbon Tax  
Would Hurt The Canadian Economy", social_class="EGP Class Category")))

And when I take out the labeling_borders commands and insert the  
following,
 >labeling=labeling_values(value_type=c("residuals"), suppress=0)

then I do get the residuals printed, but the labels are unattractive.

How do I combine labeling_borders and labeling_values commands in one  
command.

Yours, Simon Kiss
On 12-May-10, at 2:42 PM, Jim Lemon wrote:

            
*********************************
Simon J. Kiss, PhD
SSHRC and DAAD Post-Doctoral Fellow
John F. Kennedy Institute of North America Studies
Free University of Berlin
Lansstra?e 7-9
14195 Berlin, Germany
Cell: +49 (0)1525-300-2812,
Web: http://www.jfki.fu-berlin.de/index.html
#
On Thu, 13 May 2010, Simon Kiss wrote:

            
labeling_values() is a combination of labeling_borders() plus 
labeling_cells(). If you want finer control over what happens, I recommend 
to use labeling_borderes() in your mosaic() call and then call 
labeling_cells() manually afterwards. There is an example on how to do 
this in Section 4.2 of the strucplot vignette:
   vignette("strucplot", package = "vcd")

hth,
Z
#
On Wed, 12 May 2010, Simon Kiss wrote:

            
This is difficult. In grayscale printing you have just one dimension 
available for color shading, namely the luminance/brightness. This is 
already used for the size of the residuals and so you need something else 
to code the sign. In our HCL palettes this is done by the hue but in such 
a way that the choice of hue does not change the luminance (this is the 
excellent feature of HCL color space). So, as Jim already pointed out, you 
can just do something about the type of filling or the borders etc. 
Another option would be to use a single grayscale with dark colors for 
large positive residuals and bright colors for large negative residuals 
(or vice versa). However, none of the approaches will be very intuitive 
and the color version will be much more powerful.

If you are forced to use grayscale, you might consider putting an 
assocation plot (via function assoc()) next to the mosaic plot.

Best,
Z