how to display all the coordinates in a grid with 6 decimals values on a plot?
2 views (last 30 days)
Show older comments
Iam trying to create a mesh grid and based on my x, y values I am plotting (xx,yy) together but the grids are not showing 6 decimal values as intended. x=[79.512324:0.00001:79.546527]; y=[18.694465:0.00001:18.733100]; [xx,yy]=meshgrid(x,y); plot (xx,yy)
attached the grid plot below where it does not display entire 6 decimal place values. please help thanks.
0 Comments
Answers (2)
Image Analyst
on 2 Jul 2017
I'm not sure what you want, but I don't think you don't know what meshgrid gives you. Try this and see if it's what you want:
% Make 50x50 grid of points.
x = linspace(79.512324, 79.546527, 50);
y = linspace(18.694465, 18.733100, 50);
[xx, yy] = meshgrid(x, y);
plot(xx(:),yy(:), 'b.')
drawnow;
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0, 1, 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
promptMessage = sprintf('Do you want to Continue processing,\nor Quit processing?');
titleBarCaption = 'Continue?';
buttonText = questdlg(promptMessage, titleBarCaption, 'Continue', 'Quit', 'Continue');
if strcmpi(buttonText, 'Quit')
return;
end
% Print (x,y) values at each point with 6 decimal places.
% Note: you probably don't want to do this!!!! It will cover up all the points!!!
for k = 1 : numel(xx)
str = sprintf('(%.6f, %.6f)', xx(k), yy(k));
text(xx(k), yy(k), str);
end
0 Comments
Walter Roberson
on 3 Jul 2017
If you have R2015a or later then set the ticklabelformat of the axes XRuler and YRuler properties https://www.mathworks.com/help/matlab/ref/numericruler-properties.html if the question is about the x and y axes labels.
If the question is about the data cursor then use datacursormode and set its callback to output the current point in the format you want. See the datacursormode examples
0 Comments
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!