Add dotcharts next to boxplots

#1
I've got all the box plots:
Code:
boxplot( Daten$Gewicht~interaction(Daten$Dosis,Daten$Geschlecht, drop=TRUE), ylab="relative Nierengewichte", xlab="Dosisgruppen der beiden Geschlechter")
and the points overlapping the box plots:
Code:
points( Daten$Gewicht~interaction(Daten$Dosis,Daten$Geschlecht, drop=TRUE))
but is it possible to get the points next to each box plots?

thanks!
 
#3
I think I should copy a bit more from my dataset:
Dosis weight sex
1 0 6.62 m
2 0 6.65 m
3 0 5.78 m
4 0 5.63 m
5 0 6.05 m
6 0 6.48 m
7 0 5.50 m
8 0 5.37 m
9 1 6.25 m
10 1 6.95 m
11 1 5.61 m
12 1 5.40 m
13 1 6.89 m
14 1 6.24 m
15 1 5.85 m
16 2 7.11 m
17 2 5.68 m
18 2 6.23 m
19 2 7.11 m
20 2 5.55 m
21 2 5.90 m
22 2 5.98 m
23 2 7.14 m
24 3 6.93 m
25 3 7.17 m
26 3 7.12 m
27 3 6.43 m
28 3 6.96 m
29 3 7.08 m
30 3 7.93 m
31 4 7.26 m
32 4 6.45 m
33 4 6.37 m
34 4 6.54 m
35 4 6.93 m
36 4 6.40 m
37 4 7.01 m
38 4 7.74 m
39 4 7.63 m
40 4 7.62 m
41 4 7.38 m
42 0 7.11 w
43 0 7.08 w
44 0 5.95 w
45 0 7.36 w
46 0 7.58 w
47 0 7.39 w
48 0 8.25 w
49 0 6.95 w
50 1 6.23 w

then the box plots for each sex and Dosis:
Code:
boxplot( Daten$weight~interaction(Daten$Dosis,Daten$sex, drop=TRUE))
then the points:

Code:
points( Daten$weight~interaction(Daten$Dosis,Daten$sex, drop=TRUE))
I hope now you see what I have
 

trinker

ggplot2orBust
#4
When you're posting code, dataframes or computer output it's helpful to wrap this information in code tags by:
  1. either clicking the pound (#) sign icon or
  2. wrap with [NOPARSE]
    Code:
    some code
    [/NOPARSE]

which produces:
Code:
some code
For more see this (LINK)
 

bugman

Super Moderator
#5
You can use "offset" like this:

Code:
x<-(c(5,10,15,20))
     y<-(c(11,12,14,17))
     points<-(c(,10,10,10,10))
     plot(x,y)
     offset<-(0.3)
     points(x+offset,y,pch=7,col="blue")
But if you are wanting to just illustrate the raw values you could use "jitter" or apply a rug plot to your y axis.
 
#6
I did this:
Code:
boxplot( Daten$weight~interaction(Daten$Dosis,Daten$sex, drop=TRUE))
means<-tapply( Daten$weight, Daten$Dosis, mean)
points(means, pch=5, col="red", lwd=5)
and got the dots for means, but only for male, so only 5 of the 10 boxplots have that, I just don't understand why
 

trinker

ggplot2orBust
#7
When you're posting code, dataframes or computer output it's helpful...
Here's an example:

Code:
  Plant   Type  Treatment conc uptake
1   Qn1 Quebec nonchilled   95   16.0
2   Qn1 Quebec nonchilled  175   30.4
3   Qn1 Quebec nonchilled  250   34.8
4   Qn1 Quebec nonchilled  350   37.2
5   Qn1 Quebec nonchilled  500   35.3
6   Qn1 Quebec nonchilled  675   39.2
Or even better use the dput function and post that as in:

Code:
dat<- structure(list(Plant = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Qn1", 
    "Qn2", "Qn3", "Qc1", "Qc3", "Qc2", "Mn3", "Mn2", "Mn1", "Mc2", 
    "Mc3", "Mc1"), class = c("ordered", "factor")), Type = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("Quebec", "Mississippi"), class = "factor"), 
        Treatment = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("nonchilled", 
        "chilled"), class = "factor"), conc = c(95, 175, 250, 350, 
        500, 675), uptake = c(16, 30.4, 34.8, 37.2, 35.3, 39.2)), .Names = c("Plant", 
    "Type", "Treatment", "conc", "uptake"), row.names = c(NA, 6L), class = c("nfnGroupedData", 
    "nfGroupedData", "groupedData", "data.frame"))

It makes it more difficult to work with your data when it's not in code tags. Also 2 more things:

  1. You haven't got an answer because we haven't got what you're asking. A picture helps. But at the very least specific language. See if a google search produces a picture you're after. If not hand draw it, take a pic w/ your phone and upload it.
  2. You have cross posted this question at another website. That's not considered highly. It means someone may be working on a problem that has alread been solved elsewhere. You're even less likely to get an answer there with a question that's vague.