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

1 visualizzazione (ultimi 30 giorni)
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?

Risposta accettata

Jan
Jan il 20 Mag 2022
Modificato: Jan il 20 Mag 2022
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.

Più risposte (0)

Categorie

Scopri di più su Graphics Object Properties in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by