Rescale tick marks on UIAxes
4 次查看(过去 30 天)
显示 更早的评论
I have a figure that represents a grayscale image. Its resolution is 1280x960. If I show the axes, this is what it shows. When I zoom in, I get the proper vector scaled axis tick marks.
I want to change the tick marks to be distance rather than resolution. I have created my own internal function that will determine pixel distance related to the scale given on the image.
For this note that:
pixel_distance = 0.1;
The image is attached. Here is the code I use to generate tick marks:
xlen = rescale(get(app.UIAxes,'xtick'),0,size(image,2)*pixel_distance);
ylen = rescale(get(app.UIAxes,'ytick'),0,size(image,1)*pixel_distance);
xt=arrayfun(@num2str,xlen,'un',0);
yt=arrayfun(@num2str,ylen,'un',0);
set(app.UIAxes,'xticklabel',xt,'yticklabel',yt)
set(app.UIAxes,'xtick',xlen,'ytick',ylen)
But this gives the wrong output:
If I just use this code:
xlen = rescale(get(app.UIAxes,'xtick'),0,size(image,2)*pixel_distance);
ylen = rescale(get(app.UIAxes,'ytick'),0,size(image,1)*pixel_distance);
xt=arrayfun(@num2str,xlen,'un',0);
yt=arrayfun(@num2str,ylen,'un',0);
set(app.UIAxes,'xticklabel',xt,'yticklabel',yt)
I am only setting the label string values but not the physical quantities. So when I scroll in the tick marks do not change as they should.
_______________
Does somebody know how I can correctly fix the scaling on the tick marks to represent distance rather than resolution?
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Feature Detection and Extraction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!