Skip to content
Back to formatted view

Raw Message

Message-ID: <OF793328A0.015C7631-ON882574C8.00798750-882574C8.007A31D7@fs.fed.us>
Date: 2008-09-18T22:14:41Z
From: Seth W Bigelow
Subject: Coloring spaces between lines in xyplot

Greetings:
 I wish to create a stacked line graph in xyplot, adding color to the
spaces between the lines. For example, the code below creates a plot with
two lines extending across it, and I want to color the rhomboid that is
between the upper and lower line, and between the lower line and the bottom
of the frame.
Suggestions appreciated

--Seth Bigelow

library(lattice)
x=seq(1,10)                   #define independent variable
lo = 1+1.5*x                  #create lower line
hi = lo + (0.2 + 1.3*x)                # create upper line, add it to lower

xyplot(
  lo+hi~x,
  type="l",
  main = "Stacked Line plot",
  xlim=c(1,10))