user1729770
user1729770

Reputation: 85

How do I set the axes in a matlab comet plot

I am making a comet plot, which works fine in plotting the actual curve as "time" evolves. My problem is that the axes are always adjusted so that the plot completely fills the figure. In this case the plot is an ellipse, and I'd like the y- and x-axes to have the same range so that there will be some space between the ellipse and the figure window borders.

I've tried placing axes([-18 18 -18 18]) and axes equal all over the place.

I've tried using something like this (r12 is my x- and y-coordinate matrix)

ax=axes;
set(ax,'xlim',[-18 18],'ylim',[-18 18]);
comet(ax,r12(:,1),r12(:,2))

but MATLAB keeps putting the y-axis to [-3 3] and the x-axis to [-1 18] (due to my data, the ellipse is approximately 6 by 18).

How do I make the comet plot with predetermined axes?

Upvotes: 3

Views: 3491

Answers (1)

Rasman
Rasman

Reputation: 5359

Looking at the comet code, you may have a small bug on your hand.

One possible workaround is the apply a hold command to your axes:

ax=axes;
set(ax,'xlim',[-18 18],'ylim',[-18 18]);
hold (ax)
comet(ax,r12(:,1),r12(:,2))

Upvotes: 5

Related Questions