Filter löschen
Filter löschen

How can I merge the plot using the same x axis and y axis?

6 Ansichten (letzte 30 Tage)
Kittiwat Kamlungsua
Kittiwat Kamlungsua am 28 Dez. 2020
Kommentiert: Adam Danz am 28 Dez. 2020
Hi guys!
I want to ask how to merge the plot to be like this example (not mine, just get it from Google):
I tried using 'tiledlayout' command but it does not merge like the one I show. Do you have any ideas how? Thanks.

Antworten (1)

Cris LaPierre
Cris LaPierre am 28 Dez. 2020
The closest MATLAB function I can think of is stackedplot. It's not exactly the same, but it's an easy way to get something close without having to put in a lot of manual effort.
Here's an example from the linked documentation page.
tbl = readtable('patients.xls');
stackedplot(tbl,{'Height','Weight','Systolic','Diastolic'})
  1 Kommentar
Adam Danz
Adam Danz am 28 Dez. 2020
To use one global ylabel,
h = stackedplot(rand(20,11));
% Get axis handles
ax = flipud(findobj(h.NodeChildren, 'Type','Axes'));
% Remove all ylabels
set([ax.YLabel],'String','')
% Set the middle ylabel
ax(floor(numel(ax)/2)).YLabel.String = 'Global Y Label';
ax(floor(numel(ax)/2)).YLabel.Rotation = 90;
ax(floor(numel(ax)/2)).YLabel.VerticalAlignment = 'Bottom';

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Formatting and Annotation finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by