Hi Michael,

What I run into is that I have a lot of time-series data from groundwater
wells but when plot it..it becomes way to busy to see what is going on.

For example, here is the code to load and plot my Mammoth Cave rainfall pH
data

#Load data from web page
data <- read.csv("http://doylesdartden.com/Monthly-pH-example.csv";, sep=",")
attach(data)

#Plot data
plot(Year,MC.pH,pch="*",col="blue")

# Apply loess smoothing
y.loess <- loess(y ~ x, span=0.8, data.frame(x=Year, y=MC.pH))

# Compute loess smoothed values for all points along the curve
y.predict <- predict(y.loess, data.frame(x=Year))

# Plots the curve.
lines(Year,y.predict,lwd=3,col="blue")

#Done

What I would like to do is to have it plot the MC.pH data vs. year and the
MV.pH vs. year data and then draw two different smoothed lines for the
data.  This way I could really just look at the two smoothed lines and see
how the data is trending in relationship to each other.

Thanks
David


On Mon, Apr 23, 2012 at 11:40 PM, R. Michael Weylandt <
michael.weyla...@gmail.com> wrote:

> The scatter plot is easy:
>
> plot(pH1 ~ pH2, data = OBJ)
>
> When you say a loess for each -- how do you break them up? Are there
> repeat values for pH1? If so, this might be hard to do in base
> graphics, but ggplot2 would make it easy:
>
> library(ggplot2)
> ggplot(OBJ, aes(x = pH1, y = pH2)) + geom_point() + stat_smooth() +
> facet_wrap(~factor(pH1))
>
> or something similar.
>
> Michael
>
> On Mon, Apr 23, 2012 at 11:26 PM, David Doyle <kydaviddo...@gmail.com>
> wrote:
> > Hi folks.
> >
> > If I have the following in my "data"
> >
> > event    pH1    pH2
> > 1            4.0     6.0
> > 2            4.3     5.9
> > 3            4.1     6.1
> > 4            4.0     5.9
> > and on and on..... for about 400 events
> >
> > Is there a way I can get R to plot event vs. pH1  and event vs. pH2 and
> > then do a loess or lowess line for each??
> >
> > Thanks in advance
> > David
> >
> >        [[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.
>

        [[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