Hi,

I have had some troubles using doubleYScale. No matter what I try, I cant 
manage to change the color of the y-axis in the end. I have to produce a black 
and white plot. There is also something I do not understand regarding 
fontfamilyj="serif" when using it in:
strip=strip.custom()

Maybe someone has a better idea for defining which line and dots belong to 
which y-axis when not using a colorcode than the one I had.

I have annotated my questions in the code below.

Thank you for your time!


Here is some dummy data:

Ndata <- data.frame(
  Ncellpercent = rnorm(400, mean = rep(c(14, 18, 65), each = 40),
               sd = rep(c(1, 3, 6), each = 40)),
  fyear = rep(c('2007', '2008'), each = 100*2),
  Station = sample(c('B1', 'H2', 'H3', 'H4'), 400, replace = TRUE),
  Week = sample(c('19', '21', '23', '25'), 400, replace = TRUE))

Pdata <- data.frame(
  Ppercentcell = rnorm(400, mean = rep(c(4, 17, 22), each = 40),
               sd = rep(c(0.1, 0.2, 0.4), each = 40)),
  fyear = rep(c('2007', '2008'), each = 100*2),
  Station = sample(c('B1', 'H2', 'H3', 'H4'), 400, replace = TRUE),
  Week = sample(c('19', '21', '23', '25'), 400, replace = TRUE))

SummNdata <- ddply(Ndata, .(Week, fyear, Station), summarise,
                   mean = mean(Ncellpercent),
                   sd = sd(Ncellpercent))
names(Pdata)
SummPdata <- ddply(Pdata, .(Week, fyear, Station), summarise,
                   mean = mean(Ppercentcell),
                   sd = sd(Ppercentcell))
library(lattice)
library(latticeExtra)
library(HH)

font.settings <- list( font = 1, cex = 1.2, fontfamily = "serif")

my.theme <- list(
  par.xlab.text = font.settings,
  par.ylab.text = font.settings,
  axis.text = font.settings,
  par.sub=font.settings)

plotN <- xyplot(mean ~ Week | Station*fyear,
                col="black",
                pch=1,
                cex=1.1,
                lty=1,
                strip = strip.custom(bg = 'white', style=1), # why can I not 
use fontfamily="serif" here ???
                key=list(text=list(c(""),
                                   col=c("black")),
                         points=list(pch=1, lty=1, cex=1.5,
                                     col=c("black")),
                         columns=1, border=F,
                         x = 0.02, y = 0.55, corner = c(2, 2),
                         title="", cex.title=1.3),
                ylab = ("Nc"),
                xlab="Week",
                data= SummNdata,type="o",
                par.settings = my.theme)
plotN
# I would like to add the standard deviations (sd) to the plot. I have tried 
some stuff,
# but for some reason, it does not seem to work. How would I go about this?


plotP <- xyplot(mean ~ Week | Station*fyear,
                col="black",
                pch=2,
                cex=1.1,
                lty=2,
                strip = strip.custom(bg = 'white', style=1), # why can I not 
use fontfamily="serif" here ???
                key=list(text=list(c(""),
                                   col=c("black")),
                         points=list(pch=1, lty=1, cex=1.5,
                                     col=c("black")),
                         columns=1, border=F,
                         x = 0.2, y = 0.2, corner = c(2, 2),
                         title="", cex.title=1.3),
                ylab = ("Pc"),
                xlab="Week",
                data= SummPdata,type="o",
                par.settings = my.theme)
plotP

doubleYScale(plotN, plotP, add.ylab2 = TRUE)  #Why can I not change the axis 
color by adding to this argument?

# I want the y1 and y2 axes to be defined not by color, but by shape and 
linetype.
# I have managed to draw the shapes (defined by Nc and Pc) by the y1 and y2 
axes, but I do not manage to get the lines
# though the shape - ideas?
# Alternative ways that are not based on color (I have to do this black and 
white).
# Is there possible to add shapes to the axis text? such as:
# --O-- Nc  on the left y-axis (but with lty=1: I could not do a non-dotted 
line on the keybord).

with kind regards

Anna Zakrisson Braeunlich
PhD student

Department of Ecology, Environment and Plant Sciences
Stockholm University
Svante Arrheniusv. 21A
SE-106 91 Stockholm
Sweden/Sverige

Lives in Berlin.
For paper mail:
Katzbachstr. 21
D-10965, Berlin - Kreuzberg
Germany/Deutschland

E-mail: anna.zakris...@su.se
Tel work: +49-(0)3091541281
Mobile: +49-(0)15777374888
LinkedIn: http://se.linkedin.com/pub/anna-zakrisson-braeunlich/33/5a2/51b

><((((º>`•. . • `•. .• `•. . ><((((º>`•. . • `•. .• `•. .><((((º>`•. . • `•. .• 
>`•. .><((((º>

        [[alternative HTML version deleted]]

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

Reply via email to