How to make zoom in and zoom out functions of a figure work in this situation?
3 次查看(过去 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!