Two different grids on same axes

8 ビュー (過去 30 日間)
Marcel345614
Marcel345614 2021 年 4 月 22 日
回答済み: Pratheek Punchathody 2021 年 4 月 27 日
Is it allowed to do the following:
figure
ax1=axes()
hold on
x1=0.2:0.05:1
x2=0.1:0.1:1.2 %different axis
p1=plot(x1,x1.^2,'Parent',ax1)
p2=plot(x2,x2.^2,'Parent',ax1)
set(ax1,'Box','off','Xlim',[0.2 0.9],'Ylim',[0 1])
hold off
I mean, I plot two curves with different spacings of the data points on the same axes ax1. Could this somehow skretch or compress the shape of the curve in a strange way?

回答 (1 件)

Pratheek Punchathody
Pratheek Punchathody 2021 年 4 月 27 日
Currently the ticks and grid line spacing are associated and so the only way to change grid spacing is to change the tick spacing. Here are some examples:
figure;
plot(1:100);
set(gca,'xtick',[0:13:100]);
set(gca,'ytick',linspace(0,100,13));
% The following code changes the minor grid
% spacing by adjusting the tick spacing:
figure
plot(1:100);
grid on
grid minor
set(gca,'xtick',[0:50:100])
set(gca,'ytick',[0:50:100])

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by