On Fri, Sep 28, 2012 at 11:03 PM, Elaine Kuo <elaine.kuo...@gmail.com>wrote:

> Hello
>
> Thanks again.
>
> I got the attached graph
> Unsure why the color is still inconsistent.
> Please kindly share with your R version.
>

It is not my version you need to worry about, but your own...
Post the following outputs (without the prompt):

> sessionInfo()
> str(dataN)
> The complete code you run on a vanilla session (at this point I can only
guess you changed mine somehow)
> dput(dataN)

That will be better than having me or anyone in R-help play "guess how I
got this plot".





> Also, I want to add one line in the command.
> levels(dataN$Diet_B) <- diet.code
> diet.code <- c("Herbivore_t", "Herbivore_w", "Nectivore", "Frugivore",
> "Granivore",
>     "Scavenger", "Carnivore",
>     "Insectivore_t", "Insectivore_w", "Insectivore_a",
>     "Molluscivore", "Crustacean feeder", "Omnivore")
>
> Please kindly help how to make the levels vertical instead of horizontal.
>
> Elaine
>
> On Sat, Sep 29, 2012 at 12:28 PM, ilai <ke...@math.montana.edu> wrote:
>
>> Not sure why this is going wrong for you.
>> Copy paste AS IS the following to your console in the directory
>> containing for_lattice.csv
>>
>> str(dataN <- read.csv('for_lattice.csv')[,2:3])
>> dataN$Diet_B <- factor(dataN$Diet_B)
>>
>> Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
>> "sienna2","red2","firebrick3","saddlebrown","coral4","chocolate4","darkblue","navy","grey38")
>>  require(lattice)
>> bwplot(MS_midpoint_lat~Diet_B,dataN,pch='|',
>> par.settings = list(
>> plot.symbol =list(col = rep(Diet.colors,c(1,0,0,1,0,0,3,6,1,0,2,0,1)) ),
>> box.dot =list(col=Diet.colors),
>> box.rectangle=list(col=Diet.colors),
>> box.umbrella=list(lty=1,col=Diet.colors)))
>>
>> Are you seeing this ?
>>
>>
>>
>> On Fri, Sep 28, 2012 at 7:06 PM, Elaine Kuo <elaine.kuo...@gmail.com>wrote:
>>
>>> Hello
>>>
>>> Thanks for the quick response.
>>>
>>> For your code,
>>> the result is attached Q1.
>>>
>>> Please kindly help with the same color of box line and whisker just like
>>> box 1 of green.
>>>
>>> I attached my data and plot result (Q2).
>>> Please kindly help change the median from "I" to "-."
>>>
>>> Thanks a lot.
>>>
>>> Elaine
>>>
>>>
>>> On Sat, Sep 29, 2012 at 8:21 AM, ilai <ke...@math.montana.edu> wrote:
>>>
>>>> Me again...
>>>> Sorry I just noticed you did provide reproducible code in your
>>>> original. To get your plot:
>>>>
>>>> require(lattice)
>>>> set.seed(5)
>>>>
>>>> Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
>>>> "sienna2","red2","firebrick3","saddlebrown","coral4","chocolate4","darkblue","navy","grey38")
>>>>  bwplot(rgamma(20*13,1,.1)~gl(13,20), pch = "|",
>>>> par.settings = list(
>>>> plot.symbol =list(col = rep(Diet.colors,c(0,1,1,3,1,0,3,0,0,1,1,1,0)) ),
>>>> box.dot =list(col=Diet.colors),
>>>> box.rectangle=list(col=Diet.colors),
>>>> box.umbrella=list(lty=1,col=Diet.colors)))
>>>>
>>>> The box arguments set the box parameters (lty,col etc.) but the
>>>> plot.symbol sets the outliers parameters (again pch, col etc.). Note the
>>>> rep vector! it is because box 1 doesn't have an outlier, but box 4 has 3.
>>>> You will need to construct it based on your real data or the colors will be
>>>> off.
>>>>
>>>> Cheers
>>>>
>>>>
>>>> On Fri, Sep 28, 2012 at 5:55 PM, ilai <ke...@math.montana.edu> wrote:
>>>>
>>>>>
>>>>> On Fri, Sep 28, 2012 at 4:17 PM, Elaine Kuo 
>>>>> <elaine.kuo...@gmail.com>wrote:
>>>>>
>>>>>> Hello Ilai,
>>>>>>
>>>>>> Thank you for the response.
>>>>>> It did help a lot.
>>>>>>
>>>>>> However, a beginner to lattice has three questions.
>>>>>>
>>>>>> Q1
>>>>>>
>>>>>> Please kindly explain why "in this case OP is using it with no "at"
>>>>>> argument,""
>>>>>>
>>>>>
>>>>> Quoting from ?panel.bwplot.intermediate.hh (i.e. help file)
>>>>>
>>>>> "
>>>>> Description:
>>>>>
>>>>>      Panel function for ‘bwplot’ that give the user control over the
>>>>>      placement of the boxes.  When used with a positioned factor, the
>>>>>      boxes are placed according to the position associated with the
>>>>>      factor.
>>>>> "
>>>>>
>>>>> You did not supply a position factor ("at" argument) so all you are
>>>>> doing is using HH::panel.bwplot instead of the original
>>>>> lattice::panel.bwplot. This would have been OK but seems like there were
>>>>> some changes made to panel.bwplot.intermediate.hh so it doesn't give you
>>>>> what you want
>>>>>
>>>>> so it is possible to display the median and the outliers with
>>>>>> different pch?
>>>>>>
>>>>>
>>>>> Did you run my examples ? I see the attached for the second. Is this
>>>>> not what you want ? if you did run my examples and see something else, try
>>>>> again in a new R session with only lattice loaded. Let me know.
>>>>>
>>>>>
>>>>>>
>>>>>> Q2.
>>>>>> what is the relationship between package "HH" and graphic-drawing?
>>>>>> I checked ??HH and found little explanation on its function of
>>>>>> graphic-drawing.
>>>>>>
>>>>>
>>>>> Intro to R and many other web resources/books will explain the R
>>>>> architecture. In general packages hold functions, and there is no problem
>>>>> to have dependencies - i.e. function in one package calling a function 
>>>>> from
>>>>> another. For example lattice has a bunch of plotting tools. HH calls one 
>>>>> of
>>>>> them (panel.bwplot) and modifies it a little to get some effect (non auto
>>>>> placement of boxes). You can use whichever package::function you want or
>>>>> even build your local copy of the function.  Richard can correct me and
>>>>> tell you more but I think HH is mostly a collection of his such local
>>>>> modifications.
>>>>>
>>>>>
>>>>>>
>>>>>> Q3
>>>>>>
>>>>>> Please kindly advise how to make outliers empty circle (pch=2) in
>>>>>> this case as the code below.
>>>>>>
>>>>>
>>>>> This is not a reproducible example. I don't have dataN. See my answer
>>>>> to Q1. Replace the formula of my (reproducible) code with yours and add 
>>>>> the
>>>>> fancy axis annotations etc.. If you are still not getting it, in the
>>>>> console type
>>>>> dput(dataN)
>>>>>
>>>>> copy paste the output to your reply.
>>>>>
>>>>> HTH
>>>>>
>>>>>
>>>>>
>>>>>> Thank you.
>>>>>>
>>>>>> code
>>>>>>
>>>>>>     Diet.colors <-
>>>>>> c("forestgreen","darkgreen","chocolate1","darkorange2","sienna2",
>>>>>>
>>>>>> "red2","firebrick3","saddlebrown","coral4","chocolate4","darkblue","navy","grey38")
>>>>>>
>>>>>>     levels(dataN$Diet_B) <- diet.code
>>>>>>
>>>>>>
>>>>>>     bwplot(MS_midpoint_lat~Diet_B, data=dataN,
>>>>>>     xlab=list("Diet of Breeding Ground", cex = 1.4),
>>>>>>     ylab = list("Latitudinal Midpoint Breeding Ground ",cex = 1.4),
>>>>>>     lwd=1.5,
>>>>>>     cex.lab=1.4, cex.axis=1.2,
>>>>>>     font.axis=2,
>>>>>>     cex=1.5,
>>>>>>     las=1,
>>>>>>     panel=panel.bwplot.intermediate.hh,
>>>>>>     bty="l",
>>>>>>     col=Diet.colors,
>>>>>>     pch=rep("l",13),
>>>>>>     scales=list(x=list(rot=90)),
>>>>>>     par.settings=list(plot.symbol = list(pch = 2, cex =
>>>>>> 2),box.umbrella=list(lty=1)))
>>>>>>
>>>>>> Elaine
>>>>>>
>>>>>>
>>>>>> On Sat, Sep 29, 2012 at 2:44 AM, ilai <ke...@math.montana.edu> wrote:
>>>>>>
>>>>>>> On Fri, Sep 28, 2012 at 6:57 AM, Richard M. Heiberger <
>>>>>>> r...@temple.edu> wrote:
>>>>>>>
>>>>>>>> Elaine,
>>>>>>>>
>>>>>>>> For panel.bwplot you see that the central dot and the outlier dots
>>>>>>>> are
>>>>>>>> controlled by
>>>>>>>> the same pch argument.
>>>>>>>
>>>>>>>
>>>>>>> ??? I don't think so...
>>>>>>>
>>>>>>> bwplot(rgamma(20,.1,1)~gl(2,10), pch=rep(17,2),
>>>>>>> panel = lattice::panel.bwplot)
>>>>>>>
>>>>>>> I think you mean panel.bwplot.intermidiate.hh ?
>>>>>>>
>>>>>>> BTW thank you for the useful HH package but in this case OP is using
>>>>>>> it with no "at" argument, so why not
>>>>>>>
>>>>>>> Diet.colors <- c("forestgreen",
>>>>>>> "darkgreen","chocolate1","darkorange2",
>>>>>>> "sienna2","red2","firebrick3","saddlebrown","coral4","chocolate4","darkblue","navy","grey38")
>>>>>>>  bwplot(rgamma(20*13,1,.1)~gl(13,20),
>>>>>>>   fill = Diet.colors, pch = "|",
>>>>>>>   par.settings = list(box.umbrella=list(lty=1)))
>>>>>>>
>>>>>>> cheers
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I initially set the pch="|" to match your first
>>>>>>>> example with the horizontal
>>>>>>>> indicator for the median.  I would be inclined to use the default
>>>>>>>> circle
>>>>>>>> for the outliers and
>>>>>>>> therefore also for the median.
>>>>>>>>
>>>>>>>> Rich
>>>>>>>>
>>>>>>>> On Fri, Sep 28, 2012 at 7:13 AM, Sarah Goslee <
>>>>>>>> sarah.gos...@gmail.com>wrote:
>>>>>>>>
>>>>>>>> > I would guess that if you find the bit that says pch="|" and
>>>>>>>> change it to
>>>>>>>> > pch=1 it will solve your question, and that reading ?par will
>>>>>>>> tell you why.
>>>>>>>> >
>>>>>>>> > Sarah
>>>>>>>> >
>>>>>>>> > On Thursday, September 27, 2012, Elaine Kuo wrote:
>>>>>>>> >
>>>>>>>> > > Hello
>>>>>>>> > >
>>>>>>>> > > This is Elaine.
>>>>>>>> > >
>>>>>>>> > > I am using package lattice to generate boxplots.
>>>>>>>> > > Using Richard's code, the display was almost perfect except the
>>>>>>>> outlier
>>>>>>>> > > shape.
>>>>>>>> > > Based on the following code, the outliers are vertical lines.
>>>>>>>> > > However, I want the outliers to be empty circles.
>>>>>>>> > > Please kindly help how to modify the code to change the outlier
>>>>>>>> shapes.
>>>>>>>> > > Thank you.
>>>>>>>> > >
>>>>>>>> > > code
>>>>>>>> > > package (lattice)
>>>>>>>> > >
>>>>>>>> > > dataN <- data.frame(GE_distance=rnorm(260),
>>>>>>>> > >
>>>>>>>> > >                     Diet_B=factor(rep(1:13, each=20)))
>>>>>>>> > >
>>>>>>>> > > Diet.colors <- c("forestgreen",
>>>>>>>> "darkgreen","chocolate1","darkorange2",
>>>>>>>> > >
>>>>>>>> > >
>>>>>>>>  "sienna2","red2","firebrick3","saddlebrown","coral4",
>>>>>>>> > >
>>>>>>>> > >                  "chocolate4","darkblue","navy","grey38")
>>>>>>>> > >
>>>>>>>> > > levels(dataN$Diet_B) <- Diet.colors
>>>>>>>> > >
>>>>>>>> > > bwplot(GE_distance ~ Diet_B, data=dataN,
>>>>>>>> > >
>>>>>>>> > >        xlab=list("Diet of Breeding Ground", cex = 1.4),
>>>>>>>> > >
>>>>>>>> > >        ylab = list(
>>>>>>>> > >
>>>>>>>> > >          "Distance between Centers of B and NB Range (1000 km)",
>>>>>>>> > >
>>>>>>>> > >          cex = 1.4),
>>>>>>>> > >
>>>>>>>> > >        panel=panel.bwplot.intermediate.hh,
>>>>>>>> > >
>>>>>>>> > >        col=Diet.colors,
>>>>>>>> > >
>>>>>>>> > >        pch=rep("|",13),
>>>>>>>> > >
>>>>>>>> > >        scales=list(x=list(rot=90)),
>>>>>>>> > >
>>>>>>>> > >        par.settings=list(box.umbrella=list(lty=1)))
>>>>>>>> > >
>>>>>>>> > >         [[alternative HTML version deleted]]
>>>>>>>> > >
>>>>>>>> > > ______________________________________________
>>>>>>>> > > R-help@r-project.org <javascript:;> 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.
>>>>>>>> > >
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > --
>>>>>>>> > Sarah Goslee
>>>>>>>> > http://www.stringpage.com
>>>>>>>> > http://www.sarahgoslee.com
>>>>>>>> > http://www.functionaldiversity.org
>>>>>>>> >
>>>>>>>> >         [[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.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

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