필터 지우기
필터 지우기

Data cursor not working in 3-D bar plot

조회 수: 5 (최근 30일)
Aayush Singla
Aayush Singla 2019년 10월 9일
편집: Pratheek Punchathody 2021년 4월 6일
Hello,
I am using a 3D bar plot for M*N samples showing some values.
To show the data tips when clicked on 3D bars, I am using the following code snippet:
datacursormode on;
dcm = datacursormode(fh);
set(dcm,'updatefcn',@myBarUpdateFcn,'interpreter','None');
However, it is not working.
The same code seems to work perfectly with QuiverPlot.

답변 (1개)

Pratheek Punchathody
Pratheek Punchathody 2021년 4월 6일
편집: Pratheek Punchathody 2021년 4월 6일
As per my understanding, Data Cursor's data tips is not available in "bar3" in R2018b. The data tips in R2018a and earlier would give you data tips at the vertex of the rectangular prism, instead of giving the value passed in data like, for example, "bar" does.
Snippet of code is shown below which help you to show the data tips at the vertex of the 3D bars.
load count.dat %load the data
Z = count(1:10,:);
fh = figure;
bargraphs = bar3(Z); % Also works for "bargraphs = bar3(Z,'grouped');"
for i = 1:numel(bargraphs)
set(hggetbehavior(bargraphs(i), 'Datacursor'), 'Enable', true);
setinteractionhint(bargraphs(i), 'DataCursor', true);
end
dcm = datacursormode(fh);
When the above code Runs, figure window will be populated and you also need to enable the Data tip in this Figure Window. Following steps will help to enable the Data tip.
In the manu bar, Tool>Data Tip (enable)
Output (along with the data tip) for the above code snippet is as shown
Notice that this workaround works for regular "bar3" and "grouped" "bar3". However, when you use a datatip, it selects the bar vertices, rather than the top-center.
Hope this helps..!

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by