Jonas Stein
Jonas Stein

Reputation: 7043

When to use axis instead of xlim and ylim in matlab?

What is the difference between setting xlim and ylim or axis?

I expext that axis is not a wrapper for xlim and ylim...

Upvotes: 0

Views: 1192

Answers (1)

Adriaan
Adriaan

Reputation: 18187

From the documentation:

axis(limits) sets the x-axis and y-axis limits for the current axes. Specify limits as a four-element of the form [xmin xmax ymin ymax]. To additionally set the z-axis limits, specify a six-element vector. To additionally set the color limits, specify an eight-element vector.

So they perform the exact same thing, only axis can contain all three image axes in one command, whilst xlim, ylim and zlim set only the limits for their respective axis.

axis obviously has a lot more functionality, but purely for limits there's no real difference with the one-axis versions.

Upvotes: 2

Related Questions