How can I create a plot with two different yaxis, with one of them inside the figure?

조회 수: 5 (최근 30일)
I'd like to produce a plot that has two different yaxis, sharing the same xaxis, but with one of them inside the plot itself. Thus, this script behaviour should be similar to the behaviour of yyaxis left/right, but the right axis should be inside the figure. For clarity's sake, I'd like to have an output similar to this (obtained with Paint):
I tried with subplot, but I was not successful. Do you have any suggestion to obtain such a graph?

채택된 답변

Jan
Jan 2022년 5월 20일
편집: Jan 2022년 5월 20일
Simply create 2 axes:
FigH = figure;
Axes1H = axes(FigH, 'Position', [0.1300 0.1100 0.5 0.8150], ...
'Box', 'on');
Axes1H = axes(FigH, 'Position', [0.6300 0.1100 0.2750 0.8150], ...
'Box', 'on');
The axes can overlap also:
FigH = figure;
Axes1H = axes(FigH, 'Position', [0.1300 0.1100 0.7750 0.8150]);
Axes1H = axes(FigH, 'Position', [0.6300 0.1100 0.2750 0.8150]);
Adjust the XTicks accordingly to avoid overlapping labels.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by