How to make zoom in and zoom out functions of a figure work in this situation?
조회 수: 4 (최근 30일)
이전 댓글 표시
I have some x and y values that differ a lot in terms of their ranges. For example, the x values could be
-0.03
-0.02
0
0.01
0.03
but the y values could be
3500
5700
6800
9000
12000
I need to make an x-y plot and let users pinpoint the data points, by using the below coding:
pt = event.IntersectionPoint
Long story short. The above program will be dysfunctional in this case because x and y ranges have such big differences. What I did was to first multiply all the x values with a factor, in this case 100000 before plotting. I then changed the x-axis labels using the below script:
xt = xticks(han01);
for i=1:length(xt)
xt2{i} = num2str(xt(i)/100000);
end
set(han01,'xtickLabel',xt2);
Now, everything works great, except that the zoom in/zoom out functions of the plots are now messed up. Anyone knows how to make the zoom in / zoom out functions work in this situation?
Many thanks!
댓글 수: 3
Adam Danz
2020년 1월 22일
ahhhh I remember this now. You might remember that I recreated the same axis ranges but didn't have the problem but then I realized your plot was much smaller (embedded within an app) which increases the chance of the wrong point being selected (here's the link). But when I tried with your actual app axes, it worked when I selected the outlier data points (link).
If this problem is with the same densely plotted data I'm not sure there will be a good solution to precisely selecting a single coordinate with the mouse. Have you tried zooming into the axes in order to spread out the data points and increase your mouse's precision?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!