radiobutton to switch between scatter3 datasets?
이전 댓글 표시
I would like to extend the vizualisation in my scatter3 project to inGamut colors. Right now, what I have is this :

The points represent the unconverted sRGB colors in Lab. The data tip shows both these Lab coordinates and how far they are relative to the Destination gamut. But I would like to have a radio button that would toggle between the unconverted sRGB "Lab" colors and the converted colors, once converted with applycform to the Desination gamut. Based on my experience with the Opacity slider control, I figure my code to add this functionality could be as follows :
% First, define the control
uicontrol('Style', 'radiobutton', ______, 'Callback', {@radiobuttonCB, h}); % h is the handle of the scatter3 figure
% Then, the callback
function radiobuttonCB(SliderH, EventData, h)
h=scatter3(LabIN(2,:),LabIN(3,:),LabIN(1,:),80,RGB,'fill', 'MarkerEdgeColor', [0,0,0], 'Linewidth', 1.3);
end
The initial scatter3 function is this :
h=scatter3(Lab(2,:),Lab(3,:),Lab(1,:),80,RGB,'fill', 'MarkerEdgeColor', [0,0,0], 'Linewidth', 1.3);
I'm not sure I can simply 're-call' the scatter3 with the new X,Y, Z parameters? How should I proceed?
And then, I'll to come up with some logic to toggle back to the original Lab data... Oh boy!
채택된 답변
추가 답변 (1개)
Cris LaPierre
2021년 12월 23일
0 개 추천
Right now, your color is set by your variable RGB (which appears to be undefined in the callback function you have shared). So long as this variable gets updated with your desired colors, yes, you can just re-call the bSelection function.
However, we are unaware of what other code may exist inside this callback function. Whether this is the right approach or not will have to be decided by you after taking that into consideration.
댓글 수: 12
Roger Breton
2021년 12월 23일
Cris LaPierre
2021년 12월 23일
Just to be clear, RGB is just a variable. You are using it to specify the 'Color' property when you create the figure.
Consider sharing your app and data if you can (attach using the paperclip icon) so that we can help specifically with your application.
Roger Breton
2021년 12월 23일
Cris LaPierre
2021년 12월 23일
Your callbacks are all functions, so any variables created inside a function are lost when the function ends. The exception to this in an app are variables that are created as properties of the app.
Roger Breton
2021년 12월 23일
Roger Breton
2021년 12월 23일
Cris LaPierre
2021년 12월 23일
Roger Breton
2021년 12월 23일
Roger Breton
2021년 12월 23일
Cris LaPierre
2021년 12월 23일
편집: Cris LaPierre
2021년 12월 23일
Roger Breton
2021년 12월 23일
편집: Roger Breton
2021년 12월 23일
Roger Breton
2021년 12월 23일
카테고리
도움말 센터 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

