DiegoMaster
DiegoMaster

Reputation: 3

Different scales on x/y axis in Matlab

I've been using Matlab to draw plots for reports I'm assigned. However, I don't know how to make the axis look as shown in the link

However, the data I'm using isn't a function, but a set of points. For example:

A=[714 743 879 943 1067 1116 1214];
B=[76 82 96 84 132 115 90];
semilogx(A,B)
axis square
axis([0 10000 50 150])

would create a graph with logarithimic x-axis, but without the values nor scale presented in the link.

I've tried using semilogx function or different arguments for plot function, but failed miserably. Setting the range for x/y axis also doesn't seem to solve the problem.

Upvotes: 0

Views: 114

Answers (3)

halfer
halfer

Reputation: 20430

(Posted on behalf of the question author).

XLim and XTick with labels were enough to solve this problem.

Upvotes: 0

Pooya
Pooya

Reputation: 51

I think this is what you are looking for if you want it to look exactly like your plot sample:

A=[714 743 879 943 1067 1116 1214];
B=[76 82 96 84 132 115 90];
semilogx(A,B,'k-o','MarkerFaceColor','k')
axis square

xlim([100,1e4])
xticks_points = logspace(log10(125),log10(8000),7);
xticks(xticks_points)

ylim([40,150])
yticks(50:10:140)

Upvotes: 1

Yuval Harpaz
Yuval Harpaz

Reputation: 1426

You can change xlim like this:

xlim(minmax(A))

You may also want to control which numbers show as Xtick

set(gca,'xtick',[800,1000,1200])

Upvotes: 1

Related Questions