Problem with data points in my UIAxes
10 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I have a problem with my UIAxes in my AppDesigner. When I want to select a datapoint in my plot, my mouse position doesnt match my data point (Image1.). If I use the same code in my Run Sript everything works (Image2.)
Image1 (GUI, check mouse position):
Image2 (Matlab Script):
Here the matlab code:
figure;
[X, Y] = meshgrid(IN.range2, IN.range1);
RES2 = RES';
fig = scatter(Y(:), X(:),[],RES2(:),'filled');
xlabel(replace(IN.param1,'_',' ')); ylabel(replace(IN.param2,'_',' '));
zlabel(replace(result,'_',' '));
hcb = colorbar;
colorTitleHandle = get(hcb,'Title');
set(colorTitleHandle,'String',replace(result, '_', ' '))
fig.DataTipTemplate.DataTipRows(1).Label = replace(IN.param1, '_', ' ');
fig.DataTipTemplate.DataTipRows(2).Label = replace(IN.param2, '_', ' ');
dtRows = [dataTipTextRow(replace(result,'_',' '), RES')];
fig.DataTipTemplate.DataTipRows(end) = dtRows;
clear RES2
I like to work with extra Labels for my Data points, because I often do simulations with more than 2 parameters.
It would help me a lot if someone knows how to fix this bug.
Best Regards
1 件のコメント
dpb
2023 年 3 月 7 日
For anybody here to have any hope of answering this would require you posting a complete working example that duplicates the problem on your end.
回答 (1 件)
Kartik
2023 年 4 月 18 日
Hi,
It seems that the issue you are encountering is related to the difference between the coordinate systems of the UIAxes object in App Designer and a regular figure. To fix this, you can use the 'normalized' units for your scatter plot and then convert the mouse position to the data coordinates.
Here is the link to the MathWorks documentation on the 'normalized' units in UIAxes: https://www.mathworks.com/help/matlab/ref/matlab.ui.control.uiaxes-properties.html#d123e520428
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!