[R] surpressing tickmarks / labels x-as for two sets of boxplot (plotted as stacked boxplots)

Peter Ehlers ehlers at ucalgary.ca
Mon Nov 29 12:47:06 CET 2010


On 2010-11-29 03:17, Karin wrote:
> Hello,
>
> I am trying to plot two sets of boxplots together. These are estimates of two
> experiments and seven factors.
> The results of the two experiments I want to plot as boxplots stacked to each
> other.
> Therefore I plot first the results of the first experiment; and next with the
> add option the second set of boxplots.
> The boxplots are plotted at 'at = 1:7 - 0.15 for the first experiment and at=1:7
> + 0.15 for the second.
> I surpress plotting the tickmarks and labels succesfully for the first boxplot
> with xaxt="n".
> But for the second this does not work!
> I want to plot the tickmarks and labels  at position at=1:7, as below using the
> axis function.
> But with this code also tickmarks and labels are plotted at position
> at=1:7+0.15.
>
> boxplot(coefs ~ factor, data = temp,
>          boxwex = 0.25, at = 1:7 - 0.15,
>          subset = experiment == "first", col = "red",
>           xlab = "factor",xaxt="n",
>          ylab = "individual estimates")
>
> boxplot(coefs ~ factor, data = temp, naxt="n",add = TRUE,
>          boxwex = 0.25, at = 1:7 + 0.15,
>          subset = experiment == "second", col = "green")
>
> axis(at=1:7,side=1,c("fac1","fac2","fac3","fac4","fac5","fac6","fac7"))
>
> legend(6,-0.5, c("experiment1", "experiment2"),
>         fill = c("red", "green"))
>
> Does anyone know how I can surpress these labels for the second boxplot?
>

Perhaps all you need is a bit more care in typing: "naxt"???

Peter Ehlers

> Thanks in advance,
>
> Karin
>
>



More information about the R-help mailing list