how do i spread ticks evenly on a plot?
显示 更早的评论
How do i get the ticks on both axis to be spread evenly?
回答(2 个)
Star Strider
2019-10-10
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
2019-10-10
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);

类别
在 帮助中心 和 File Exchange 中查找有关 Grid Lines, Tick Values, and Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!