IMHO both methods (or languages) have advantages and disadvantages. Sometimes I even find basic graphics the most useful, it always depends on a lot of factors. So do not exclude any of them...
> Thanks, the ggplot2 strategy looks promising. For making > information-dense graphs, I tend to vacillate between lattice and > ggplot2. I should probably settle on one or the other and learn it > better. I'll admit I like the default look of lattice plots better, but > so far custom panel functions still baffle me. > > --Chris > > Tóth Dénes wrote: >> >> You might also consider the Deducer package. You can build up a plot by >> point and click and then have a look at (and amend) the code and learn >> the >> syntax of ggplot2, which is a nice alternative to the lattice package. >> The website of the Deducer package (www.deducer.org) is a good start. >> >> ------ >> Anyway: >> ------ >> >> mydata<- data.frame(county=factor(1:3),lowlim=c(3,6,4),uplim=c(4,7,6)) >> >> In Deducer choose: >> Plots / Plot Builder ... Geometric elements / linerange >> >> After running it, you get: >> dev.new() >> ggplot() + >> geom_linerange(aes(x = county,ymin = lowlim,ymax = >> uplim),data=mydata) >> >> >> The same in pure R: >> library(ggplot2) >> ggplot(data=mydata) + >> geom_linerange(aes(x = county,ymin = lowlim,ymax = uplim)) >> >> >> HTH, >> Denes >> >> >> >> >>> Well, a custom panel function is what you need (or one that may >>> already exist somewhere: try googling on "high low intervals in R >>> graphs" or some such). >>> >>> So if you haven;t already done so, try Paul Morrell's Chapter on >>> lattice plots from his book for how panel functions work: >>> >>> http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter4.pdf >>> >>> -- Bert >>> >>> >>> On Tue, Mar 22, 2011 at 12:12 PM, Christopher W Ryan >>> <cr...@binghamton.edu> wrote: >>>> I have a dataframe that looks like this: >>>> >>>> > str(chr) >>>> 'data.frame': 84 obs. of 7 variables: >>>> $ county: Factor w/ 3 levels "Broome","Nassau",..: 3 3 3 3 3 3 3 3 3 >>>> 3 >>>> ... >>>> $ item : Factor w/ 28 levels "Access to healthy foods",..: 21 19 20 >>>> 18 16 3 2 6 17 8 ... >>>> $ value : num 8644 15 3.5 3.9 7.7 ... >>>> $ low : num 7897 9 2.5 2.6 7 ... >>>> $ high : num 9390 22 4.5 5.2 8.4 37 30 23 24 101 ... >>>> $ target: num 5034 11 2.7 2.6 6.1 ... >>>> $ nys : num 6099 16 3.5 3.3 8 ... >>>> >>>>> head(chr) >>>> county item value low high target >>>> nys >>>> 1 Sullivan Premature death 8644.0 7897.0 9390.0 5034.0 >>>> 6099.0 >>>> 2 Sullivan Poor or fair health 15.0 9.0 22.0 11.0 >>>> 16.0 >>>> 3 Sullivan Poor physical health days 3.5 2.5 4.5 2.7 >>>> 3.5 >>>> 4 Sullivan Poor mental health days 3.9 2.6 5.2 2.6 >>>> 3.3 >>>> 5 Sullivan Low birthweight 7.7 7.0 8.4 6.1 >>>> 8.0 >>>> 6 Sullivan Adult smoking 29.0 22.0 37.0 15.0 >>>> 20.0 >>>> >>>> I'd like to graph high and low for "Premature death" for each of the >>>> three counties, with 3 vertical line segments, one connecting those >>>> two points for each county. I can get the two points for each county: >>>> >>>>> xyplot(low+high ~ county, data=subset(chr, item=="Premature death")) >>>> >>>> but I have not yet been able to figure out how to draw the 3 vertical >>>> line segments. Been struggling to understand panel functions, but no >>>> success so far. I'd be grateful for any advice. >>>> >>>> Thanks. >>>> >>>> --Chris Ryan >>>> SUNY Upstate Medical University >>>> Clinical Campus at Binghamton >>>> >>>> ______________________________________________ >>>> 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. >>>> >>> >>> >>> >>> -- >>> Bert Gunter >>> Genentech Nonclinical Biostatistics >>> >>> ______________________________________________ >>> 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. > ______________________________________________ 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.