Stacked Plots - Changing the Location and Oreintation of the Display Labels (Y Labels)
16 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Currently working on a project implementing stacked plots to display information inside of a tiled layout figure.
The image below, figure 1, is a older version that I want to update. I would like to highlight the Title for each line plotted in the graph is displayed on the right hand side. (I Correlator, Q Correlator, ... etc)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1619338/image.jpeg)
The image below, figure 2, is the version I am currently working with. I want to immitate this way of displaying Display Labels on the right hand side.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1619343/image.jpeg)
Some noticeable differences between the two versions is the use of tiled layout and the stacked plot. In this case, tiled layout creates a 2x2 seperation of the figure. This stacked plot is taking up tiles 2 and 4, using the call nexttile(t, 2, [2 1]);
How can I alter the position of the s.DisplayLabels so that they appear on the right hand side like the first figure? Or atleast rotate the labels such that they are vertical rather than horizontal?
Here is some sample code:
%% Creating demo lines to graph (y1 and y2)
x = 1:0.1:10;
y1 = sin(x);
y2 = cos(x);
tbl = table(y1', y2'); % Table to pass into the stackedplot
%% Creating the plotting figure
f = figure();
% Using tiledlayout
t = tiledlayout(f, 2, 1, "TileSpacing","compact");
nexttile(t, [2, 1]);
s = stackedplot(tbl); % Implementation of stacked plots
s.DisplayLabels = ["Line 1", "Line 2"]; % Displaying the Y Labels / Display Labels
s.LineWidth = 1.5;
s.GridVisible = "on";
s.Title = "My Graph";
0 Commenti
Risposte (1)
Adam Danz
il 17 Feb 2024
You could use the same approach to change the YAxisLocation to the right but this will also change the location of the y-axis ticks. How did you acheive this in the older version that shows the labels on the right and what is preventing you from doing that again?
Vedere anche
Categorie
Scopri di più su Axis Labels in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!