Issue with sgtitle and subplots. and question about applying a gradient hue to a lineplot

22 ビュー (過去 30 日間)
Hi folks,
I have the following code with an issue.
The sgtitle seems to appear in the output window but when the figure is opened in its own window, the title disappears!
Also, is it possible to apply a gradient hue to each line depending on another variable (temperature)?
Is there a way around this? My code is as follows:
for i = 1
figure;
myTitle = sprintf('VRA Parameters versus %s', myIDData{i});
sgtitle(myTitle);
for j = 1:14
subplot(7, 2, j);
plot(myData{i}, myData{j});
xlabel(myIDData{i}, "FontWeight","bold");
ylabel(myIDData{j}, "FontWeight","bold");
set(gca, 'xdir', 'reverse');
xlim([0 100]);
end
end

採用された回答

Star Strider
Star Strider 2022 年 9 月 20 日
編集済み: Star Strider 2022 年 9 月 20 日
It may be cut off because of the limits on the figure 'Position' or 'OuterPosition' property.
See if something like:
Fig = gcf;
pos = Fig.OuterPosition
Fig.OuterPosition = pos + [0 -200 0 200];
shifting it down by 200 and then increasing its height by 200 solves the problem.
figure
plot(1:10, randn(1,10))
grid
title('Title')
figure
plot(1:10, randn(1,10))
grid
title('Title')
Fig = gcf;
pos = Fig.OuterPosition;
Fig.OuterPosition = pos + [0 -200 0 200];
See the figure documentation on Position and Size for more information and other options to experiment with.
EDIT — (20 Sep 2022 at 15:40)
I am not certain about the gradient hue. See the patch documentation section on Create Multicolored Line for one approach.
.
  12 件のコメント
Teshan Rezel
Teshan Rezel 2022 年 9 月 23 日
@Star Strider apologies, I restarted matlab and it seems to work now! I'm not sure what the issue was but it seems to have been resolved!
Star Strider
Star Strider 2022 年 9 月 23 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by