Works ok here to plot() data on top of a boxplot; didn't use grouping variables though so the x-axes values are 1:N where N is the number of variables. I would presume that's what happens with a grouping variable but don't have anything handy to -- oh, wait a minute, ISTR one of the examples does use grouping -- yes, indeed. OK, starting from having data in the example,
figure
boxplot(MPG,Origin)
hAx=gca;
xtk=hAx.XTick;
hold on
hL=plot(xtk,rand(size(xtk))*50,'k-*');
Seems to work just fine; I'm guessing you're not plotting at the correct x,y locations given the axis limits; particularly the x-axis being ordinal so XTick-->1:N, not the value of the grouping variable.
Best Answer