how do i spread ticks evenly on a plot?

조회 수: 3 (최근 30일)
Stewart Richardson
Stewart Richardson 2019년 10월 10일
답변: Image Analyst 2019년 10월 10일
How do i get the ticks on both axis to be spread evenly?

답변 (2개)

Star Strider
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
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);
0001 Screenshot.png

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by