When I do shading interp for pcolor on App Designer the graph becomes blank.

5 views (last 30 days)
Whenever I try to change the shading or facecolor on my pcolor graph in App Designer the chart disappears and I get an error message.
The graph works when I don't try to change the shading or orientation.
pcolor(app.UIAxes,XPositions,YPositions,Temperature)
app.UIAxes.FaceColor = 'interp';
% Unrecognized property 'FaceColor' for class 'matlab.ui.control.UIAxes'.
%% It also doesn't recognize 'shading'
I also tried to use imagesc but I can't get the y-direction to flip or shading to interp.
set (app.UIAxes, gca,'YDir','normal')
% Error using matlab.ui.control.UIAxes/set
% Invalid parameter/value pair arguments.
Is this just not something that is possible on App Designer?
  1 Comment
Adi Purwandana
Adi Purwandana on 22 Feb 2023
Try to use FaceColor 'flat'
h1 = pcolor(app.UIAxes,longn,latn,log10(Epsgrid_a_50'));
h1.FaceColor = 'flat';
colormap(app.UIAxes,jet(6))
colorbar(app.UIAxes);

Sign in to comment.

Accepted Answer

Voss
Voss on 2 Jun 2022
% Unrecognized property 'FaceColor' for class 'matlab.ui.control.UIAxes'.
This error happens because FaceColor is not a uiaxes (or axes) property. It is a surface property, which is what is created by pcolor, so try this:
my_surface = pcolor(app.UIAxes,XPositions,YPositions,Temperature);
my_surface.FaceColor = 'interp';
"I also tried to use imagesc but I can't get the y-direction to flip"
Try this:
set(app.UIAxes,'YDir','normal');
(gca is the current axes; app.UIAxes is your uiaxes; it's not correct to use both.)

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!