how do i spread ticks evenly on a plot?
Show older comments
How do i get the ticks on both axis to be spread evenly?
Answers (2)
Star Strider
on 10 Oct 2019
That is plotted as a loglog plot. Either just use plot, or:
set(gca, 'XScale','linear', 'YScale','linear')
For that particular figure, this works:
F = openfig('figure_1.fig');
Ax = findobj(F, 'Type','Axes');
set(Ax, 'XScale','linear', 'YScale','linear')

Plot images aren’t showing up for some reason. I attached the image as well.
Image Analyst
on 10 Oct 2019
You mean like this:
workspace; % Make sure the workspace panel is showing.
figure(1)
% plot on large axes
plot(x, y1, 'LineWidth', 2)
grid on;
ax1 = gca; % Store handle to axes 1.
ax1.Units = 'normalized';
% Create smaller axes in top right, and plot on it
% Store handle to axes 2 in ax2.
box on;
fileName = 'tick.png';
rgbImage = imread(fileName);
% Get existing grid line locations
yt = 0.13 : 0.1 : 0.9
% Make ticks along the y axis.
for k = 1 : length(yt)
axes('Position',[0.15, yt(k), 0.1, 0.1]);
imshow(rgbImage);
axis('off', 'image');
end
% Make ticks along the y axis.
properties(ax1)
xt = 0.15 : 0.1: 0.9;
for k = 1 : length(xt)
axes('Position',[xt(k), 0.13, 0.1, 0.1]);
imshow(rgbImage);
axis('off', 'image');
end
% Now draw something back on axis 1
hold(ax1, 'on'); % Don't blow away existing curve.
y2 = cos(2*pi*x/0.7);
plot(ax1, x, y2, 'r-', 'LineWidth', 2);

Categories
Find more on Grid Lines, Tick Values, and Labels 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!