MATLAB doesn't support drawing two boxplots as you are suggesting. But, you can use a work around. The idea is to create empty box plots.
boxplot([Acceleration nan(100,1)])
boxplot([nan(100,1) Horsepower])
You can see that [Acceleration nan(100,1)] creates a 100x2 matrix with second column as nan.
- When I use boxplot for left axis, it plots two curves at x-location 1 and 2 for each column. As the second column is nans, second boxplot is empty.
- Now, for second plot, I want location-1 to be empty (as I already have plotted acceleration on that), so I use [nan(100,1) Horsepower], which will draw Horsepower at x-location 2.
For your refereimage, you will need to do something like this
boxplot([l1 nan(100,1) l2 nan(100,1) l3 nan(100,1)])
boxplot([nan(100,1) r1 nan(100,1) r2 nan(100,1) r3])
This is not what you are looking for but I think closest: