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!

