Unable to change the height of the barh.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Aksh Chordia
il 27 Lug 2023
Commentato: Star Strider
il 27 Lug 2023
I have a tiled layout wherein, of the tiles is like this.
The code looks like this:
y=[67 147-67 1073-147 3456-1073 5000-3456];
def=[1];
nexttile
d1=barh(def,y,3,'stacked');
axis ([0 5000 0 2]);
xlabel('Defect Size [Ohm]');
title('Defect 1 @ 100C');
set(gca,'ytick',[],'FontSize',30);
I am trying to reduce the height of the figure, but the position 'Position' is not working. Could you suggest any other way to do it.
Thank you
Aksh
0 Commenti
Risposta accettata
Star Strider
il 27 Lug 2023
The tiledlayout plots will not let you do that, however subplot will.
Try this —
figure
y=[67 147-67 1073-147 3456-1073 5000-3456];
def=[1];
subplot(1,1,1)
d1=barh(def,y,3,'stacked');
axis ([0 5000 0 2]);
xlabel('Defect Size [Ohm]');
title('Defect 1 @ 100C');
set(gca,'ytick',[],'FontSize',30);
figure
y=[67 147-67 1073-147 3456-1073 5000-3456];
def=[1];
subplot(1,1,1)
d1=barh(def,y,3,'stacked');
axis ([0 5000 0 2]);
xlabel('Defect Size [Ohm]');
title('Defect 1 @ 100C');
set(gca,'ytick',[],'FontSize',30);
pos = get(gca, 'Position');
set(gca,'Position',pos.*[1 1.25 1 0.25])
Experiment to get the result you want.
.
2 Commenti
Star Strider
il 27 Lug 2023
You can use global legends with subplot similarly to the way you would create it in tiledlayout.
Try something like this —
x = 0:0.5:10;
y1 = randn(size(x,2),2);
y2 = randn(size(x,2),2);
y3 = randn(size(x,2),2);
figure
subplot(2,2,1)
plot(x,y1)
grid
hl = legend('y_1','y_2'); % Create Legend, Return Handle
subplot(2,2,2)
plot(x,y2)
grid
subplot(2,2,3)
plot(x,y3)
grid
subplot(2,2,4)
Ax = gca;
Ax.Visible = 0; % Make Axes Invisible
hl.Position = Ax.Position; % Use These Position Values For 'legend'
.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Legend 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!