How do you put lcolorbar in UIAxes (app designer)?
6 ビュー (過去 30 日間)
古いコメントを表示
I have a UIAxes area in an app using app designer. I want to plot some stuff colored by category using lcolorbar (colorbar with text labels) but it won't let me. The regular colorbar can be assigned to an axes by not lcolorbar. Is there a workaround?
0 件のコメント
採用された回答
Kevin Holly
2024 年 7 月 3 日
Let's say I want to place this in App Designer.
[Z,R] = readgeoraster("n39_w106_3arc_v2.dt1","OutputType","double");
[vis,visR] = viewshed(Z,R,39.6,-105.6,1000);
figure
usamap(vis,visR)
geoshow(vis,visR,"DisplayType","surface")
cmap = [0.4940 0.1840 0.5560; 0.4660 0.6740 0.1880];
colormap(cmap)
h = lcolorbar(["Obscured" "Visible"]);
h.Position(1) = h.Position(1)-0.1;
Here is a workaround:
[Z,R] = readgeoraster("n39_w106_3arc_v2.dt1","OutputType","double");
[vis,visR] = viewshed(Z,R,39.6,-105.6,1000);
fig = figure;
usamap(vis,visR)
geoshow(vis,visR,"DisplayType","surface")
cmap = [0.4940 0.1840 0.5560; 0.4660 0.6740 0.1880];
colormap(cmap)
h = lcolorbar(["Obscured" "Visible"]);
h.Position(1) = h.Position(1)-0.1;
for ii = length(fig.Children):-1:1
fig.Children(ii).Parent = app.Panel;
end
app.Panel.Children(1).Colormap = cmap;
app.Panel.Children(2).Colormap = cmap;
delete(fig)
I created the graphics on a figure (named fig) and then transfered each child of the figure to the a uipanel or uifigure. In this case, I chose app.Panel. I then had to add the correct colormaps. See app attached for working example.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Geographic Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!