# [R] about plotting a special case

Jim Lemon drjimlemon at gmail.com
Thu Jul 13 04:25:39 CEST 2017

```Hi lily,
Here is the first plot:

plot(DF1\$A,DF1\$B,pch=19,col="red")
meanA<-mean(DF1\$A)
meanB<-mean(DF1\$B)
points(meanA,meanB,pch=18,col="red")
q1090<-quantile(DF1\$B,probs=c(0.1,0.9))
library(plotrix)
dispersion(meanA,meanB,q1090[2],q1090[1],
intervals=FALSE,col="red")

The same code will work for a second data frame, except that you would
use "points" instead of "plot" and change the color. You may also have
to specify xlim and ylim in the first call to "plot" so that all
values are on the plot.

Jim

On Thu, Jul 13, 2017 at 11:46 AM, lily li <chocold12 at gmail.com> wrote:
> Hi R users,
>
> I have a question about plotting. There is the dataframe below, while each
> row represents a record. If I want to plot on a A-B plot, i.e., x-axis
> represents A, while y-axis represents B values. However, I want to plot the
> mean value from records 1-10 as one point, while the 10th and 90th
> percentiles represent the error bars, such as one point in the attached
> example. I don't know how to do this, and then add a legend.
> After the above step, if I have a dataframe DF2 with the same structure but
> different values than DF1, how to show the point on the same figure, but
> use different colors or symbols? Thanks for any advices.
>
> DF1
>
>         A  B  C
> 1     65 21 54
> 2     66 23 55
> 3     54 24 56
> 4     44 23 53
> 5     67 22 52
> 6     66 21 50
> 7     45 20 51
> 8     56 19 57
> 9     40 25 58
> 10   39 24 53
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help