Boxplot with double y-axis
Show older comments
Hello All, I want to plot a boxplot with a double y-axis (reference figure is attached). Actually, I have two sets of variables. One variable value will display on the left side and another variable value will display on the right of the y-axis.
Accepted Answer
More Answers (4)
Hi,
The key idea is to activate the axis that you want to plot. Suppose I have two ys : y1 and y2, I want to plot y1 on the left side and y2 on the right side, I can do as shown here:
yyaxis left
plot(x,y1);
yyaxis right
plot(x,y2);
You can read more about it at the example shown here.
sunny kant
on 24 Aug 2022
0 votes
1 Comment
I think it is working as intended, as there are two boxplots at the same 'x'.
A simple example is here
load carsmall
yyaxis left
boxplot(Acceleration)
yyaxis right
boxplot(Horsepower)
What you are looking for is a no superposition.
sunny kant
on 24 Aug 2022
0 votes
sunny kant
on 24 Aug 2022
0 votes
Categories
Find more on Exploration and Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!