Setting axis limits of a plot

I have two sets of data, x and y which I am plotting together:
plot(x,y)
I'm having a problem setting the axis limits however. I am using the method shown in the online documentation:
axis([xmin,xmax,ymin,ymax])
Or in my case:
axis([1,1024,1,1024])
The problem is when I enter this it creates a new figure with the correct limits but with no data plotted.

 Réponse acceptée

Paulo Silva
Paulo Silva le 4 Juil 2011

0 votes

axis(gca,[1,1024,1,1024])
or
ax=axes
plot(x,y)
axis(ax,[1,1024,1,1024])

3 commentaires

Matt
Matt le 4 Juil 2011
Thankyou for this, however I've just realised that I was making a mistake and the reason it was blank is because the data wasn't within the limits specified.
On a side note is there any way to change the direction of an axis, for example the y axis has 0 at the top and 1024 at the bottom?
Paulo Silva
Paulo Silva le 4 Juil 2011
set(gca,'ydir','reverse')
C.J. Harris
C.J. Harris le 4 Juil 2011
or simply:
axis ij

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Polar Plots dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by