Hi,
I am trying to plot a point cloud of data on an axes whose Parent is a uipanel. The uipanel was created on a figure. The issue I am having is that when I am trying to show the point cloud data using pcshow, I am getting an error as follows:
PC = pointCloud(dataPts); % Where dataPts is a Nx3 array of 3D coordinates
pcshow(PC, 'Parent', ax); % where ax is the handle to the axes whose 'Parent' is a uipanel
No appropriate method, property, or field 'Renderer' for class 'matlab.ui.container.Panel'.
Error in pcshow (line 106) if strcmpi(hFigure.Renderer, 'painters')
It seems like the pcshow only works when the axes's 'Parent' is a figure, otherwise it will not find the 'Renderer' properties (such as within the uipanel).
Is there any way of plotting point cloud data on an axes that is a 'child' of a uipanel?
Thanks a lot in advance!
Kind Regards, Andre

 채택된 답변

Guojin Feng
Guojin Feng 2018년 2월 9일

1 개 추천

I had encountered the same issue. One option would be to modify the pcshow function Modify the line around Line 108
% Get the current figure handle
hFigure = get(currentAxes,'Parent');
as
htmp = currentAxes;
while true
hFigure = get(htmp, 'Parent');
htmp = hFigure;
if isa(hFigure, 'matlab.ui.Figure')
break;
end
end
Hope this helps.

댓글 수: 3

Andre
Andre 2018년 2월 9일
Hi Guojin.
Thanks a lot for this! I will try it out over the weekend and come back to you on it. I once tried to look into the pcshow function itself but didn't want to risk modifying it.
Greatly appreciated!
Andre
You can instead use
hFigure = ancestor(currentaxes, 'Figure');
Andre
Andre 2018년 2월 13일
Thanks a lot to both parties! I tried and tested both options and they all worked seamlessly!
Andre

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

추가 답변 (1개)

Sindhu Priya
Sindhu Priya 2017년 3월 28일
편집: Sindhu Priya 2017년 3월 28일

0 개 추천

Hi Andre,
As far as I know, 'pcshow' does not allow you to plot on any other axes apart from 'figure'. You can use 'scatter3' fucntion to plot your data on the axes of uipanel as follows,
ax = axes('Parent',uipanel,'Position',[.1 .1 .6 .6]);
scatter3(x,y,z,'Parent',ax)
Please refer
and
for further information.
Regards,
Sindhu

카테고리

질문:

2017년 3월 23일

댓글:

2018년 2월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by