[R] set linetype with plotCI

David Barron mothsailor at googlemail.com
Mon Oct 16 13:43:17 CEST 2006


Looking at the source code for plotCI, I see that it calls plot with
type specified as "n" when  the error bars are not being added to an
existing plot, so you cannot use the type argument in a call to
plotCI.  If you want to add lines as well as points, I think you will
have to use lines(x,y,type="b",lty = plot_linetypes[graph_idx]) in
addition to plotCI, or amend the plotCI function to your own
specifications.

On 16/10/06, JeeBee <JeeBee at troefpunt.nl> wrote:
> Thanks, I tried using plotCI in the plotrix library.
> This, however, gives me the below error.
>
> CODE::
>       cat("x = "); print(xvals.f[sorted])
>       cat("y = "); print(yvals.f[sorted])
>       cat("pch = "); print(plot_symbols[graph_idx])
>       cat("lty = "); print(plot_linetypes[graph_idx])
>       cat("col = "); print(plot_colors[graph_idx])
>       print(paste("graph_idx =", graph_idx, "and plot_cnt =", plot_cnt))
>           plotCI(
>                 x = xvals.f[sorted],
>                 y = yvals.f[sorted],
>                 xlim = c(xmin, xmax), ylim = c(ymin, ymax),
>                 pch = plot_symbols[graph_idx], type = "b",
>                 lty = plot_linetypes[graph_idx],
>                 col = plot_colors[graph_idx],
>                 barcol = plot_colors[graph_idx], uiw = NA,
>                 xlab = "", ylab = "",
>                 add = (plot_cnt > 0)
>           )
>       print("plotCI succeeeded...")
>
> OUTPUT::
>
> x =  [1] 160 160 160 160 160 160 160 160 160 160 320 320 320 320 320 320 320 320 320
> [20] 480 480 480 480 480 480 480 480 480 640 640 640 640 640 640 640 640 800 800
> [39] 800 800 800 800 800 800 800 960 960 960 960 960 960 960 960 960
> y =  [1] 0.062263829 0.062263829 0.062263829 0.062263829 0.062263829 0.062263829
>  [7] 0.062263829 0.062263829 0.062263829 0.062263829 0.029483948 0.029483948
> [13] 0.029483948 0.029483948 0.029483948 0.029483948 0.029483948 0.029483948
> [19] 0.029483948 0.018035707 0.018035707 0.018035707 0.018035707 0.018035707
> [25] 0.018035707 0.018035707 0.018035707 0.018035707 0.009895540 0.009895540
> [31] 0.009895540 0.009895540 0.009895540 0.009895540 0.009895540 0.009895540
> [37] 0.008534913 0.008534913 0.008534913 0.008534913 0.008534913 0.008534913
> [43] 0.008534913 0.008534913 0.008534913 0.007301515 0.007301515 0.007301515
> [49] 0.007301515 0.007301515 0.007301515 0.007301515 0.007301515 0.007301515
> pch = [1] 0
> lty = [1] 1
> col = [1] "#FF0000"
> [1] "graph_idx = 1 and plot_cnt = 0"
> Error in plot.default(c(160, 160, 160, 160, 160, 160, 160, 160, 160, 160,  :
>         formal argument "type" matched by multiple actual arguments
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
=================================
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP



More information about the R-help mailing list