How do I reduce my right y axis scale ?

38 views (last 30 days)
Pierre Lonfat
Pierre Lonfat on 2 Mar 2018
Commented: Greg on 30 Apr 2018
Here is the actual result.
Where you can see the bar chart in green overlapping the curves which is not really nice.
The idea would be to have something like that:
Now the scale is reduce but I have unnecessary number in the right y axis and missing numbers [2 1.5 1 0.5 0].
Can someone help me with that ?
Thank you very much in advance.
Pierre
  2 Comments
dpb
dpb on 13 Mar 2018
Edited: dpb on 14 Mar 2018
Attach the data so somebody can play around without having to try to make up data that looks similar-enough.
The obvious (I think) would be when you use yyaxis to place one on the RH and another on the LH axes.
In the sequence
My actual code:
bar(riskpremium.date.raw(1:end,1), ...
hold on
plot(riskpremium.date.raw(1:end,1), ...
hold on;
plot(riskpremium.date.raw(1:end,1), ...
hold on;
...
once 'hold' is 'on', it won't get in "onner" by repeating it...once is enough on the given axis.

Sign in to comment.

Accepted Answer

Greg
Greg on 14 Mar 2018
yyaxis('right');
ylim([0,10]); % Play with 10 until it looks good
yticks(0:.5:2);

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by