why while zooming marker changes position?

前端 未结 1 1370
执笔经年
执笔经年 2020-12-21 08:43

I plot graph and markers on it. However I see strange behavior - marker changes it\'s position while zooming. I\'ve created video about that (please switch to fullhd while w

相关标签:
1条回答
  • 2020-12-21 09:24

    It's because you set the y-axis labels

    set(gca, 'YTickLabel', get(gca,'YTick'))
    

    when you now start zooming, the ticks themselves change, but the labels don't. You notice this by zooming in and at the same time observing that the range of the y-axis does not change.



    I think what you intended to do with the above yticklabel overruling is increase the accuracy of those ytick labels. But you forget to keep those labels up to date with the actual values.

    This guy: http://undocumentedmatlab.com/blog/setting-axes-tick-labels-format/ has spent some time of making this an automatic process using callbacks.

    On the file exchange the same person has a script to all automate it for you: http://www.mathworks.com/matlabcentral/fileexchange/36254-ticklabelformat

    so you only have to call

    ticklabelformat(gca,'y','%.6g')
    

    or any other format you want

    0 讨论(0)
提交回复
热议问题