App UIAxes Rendering on Mac OS broken

26 ビュー (過去 30 日間)
Mark Chapin
Mark Chapin 2024 年 11 月 29 日 16:24
回答済み: Divyam 2024 年 12 月 10 日 10:11
I'm using matlab for mac os. I creates simple app with an axes and plot random data. I see shadows of the data in the plot. Also, mouse wheel zooming is very jittery. Try a fast mouse wheel zoom and slightly move the mouse around while the zoom decelerates, it becomes almost unusable.
I'm using mac os 14.5 and apple silicon. I've confirmed the jittering on mac os with intel silicon but it is not as severer. The shadowing on intel is the same.
None of this happens if I plot from the command line > plot(randn(10000));
classdef app1_exported < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
UIAxes matlab.ui.control.UIAxes
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
plot(1:10000, randn(1,10000),"color","b", "linewidth", 2, 'parent', app.UIAxes);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'MATLAB App';
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
zlabel(app.UIAxes, 'Z')
app.UIAxes.Position = [33 20 585 445];
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app1_exported
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end

回答 (1 件)

Divyam
Divyam 2024 年 12 月 10 日 10:11
The shadows mentioned are a result of comparison between different plots ("randn" randomizes the plots created) and a lack of clarity observed when using the "plot" method for plotting directly from MATLAB command line. This lack of clarity stems from the different graphic rendering libraries used to render graphics ("plot" function utilizes the OpenGL library while the "UIFigure" component utilizes the WebGL library for graphic rendering).
On macOS, increased clarity is noted with "UIFigure" because OpenGL has been deprecated since macOS 10.14. This deprecation causes plots and other figures rendered with OpenGL to lose clarity on macOS machines: https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_threading/opengl_threading.html
The unexpected performance issues with your mouse could be caused by a high DPI display. When the pixel scale is increased due to the use of a high DPI display setting, it might cause MATLAB to utilize different line rendering pipelines, making the UI unusable as the "LineWidth" increases due to scaling.
As a workaround, you can try to scale down your display when rendering this plot using the app by changing your display resolution. For more help regarding scaling display settings on macOS 14, you can refer to this documentation:https://support.apple.com/en-us/guide/mac-help/mchl86d72b76/14.0/mac/14.0

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

タグ

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by