필터 지우기
필터 지우기

Using Scatterhist in UIAxes

조회 수: 2 (최근 30일)
Jurgis Toms Liepins
Jurgis Toms Liepins 2022년 5월 2일
답변: Nivedita 2023년 9월 14일
Is there currently a workaround for using scatterhist in UIAxes as it does not accept UIAxes as parent?
  댓글 수: 2
Kevin Holly
Kevin Holly 2022년 5월 2일
Is there anything stopping you from using axes instead of uiaxes?
Jurgis Toms Liepins
Jurgis Toms Liepins 2022년 5월 2일
@Kevin Holly Yes, I am building an app in App Designer to be deployed on a webappserver which currently does not support pop-out figures and as far as I understand there is no way to embed axes in the UIFigure.

댓글을 달려면 로그인하십시오.

답변 (1개)

Nivedita
Nivedita 2023년 9월 14일
Hi Jurgis,
I understand that you are looking for a workaround to implement the “scatterhist” function with “UIAxes” in MATLAB App Designer. You can achieve this by the following the below steps:
  1. Create a “UIAxes” component in your App Designer interface.
  2. Create a scatter plot using the “scatterhist” function outside of the “UIAxes”.
  3. Capture the scatter plot as an image using the “getframe” function.
  4. Display the captured image in the “UIAxes” using the “image” function.
function startupFcn(app)
load fisheriris
x = meas(:,1);
y = meas(:,2);
% Create a scatter plot using scatterhist outside of the UIAxes
figure('Visible', 'off');
scatterhist(x, y);
% Capture the scatter plot as an image
frame = getframe(gcf);
imageData = frame.cdata;
% Display the captured image in the UIAxes
app.UIAxes.NextPlot = 'replace'; % Optional: Clear the UIAxes before displaying the image
image(app.UIAxes, imageData);
axis(app.UIAxes, 'off'); % Optional: Hide the axis lines and ticks
end
I have used the sample data “fisheriris” to create the scatter plot with marginal histograms. By setting the “Visible” property of the figure to “off”, the figure with “scatterhist” will not be displayed.
For more information on the “scatterhist”, “getframe” and “image” functions, refer to the following links:
I hope this helps!
Regards,
Nivedita.

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by