f

#### Can one create a log-log plot with the comet function?

```I would like to create a log-log comet plot, and am not sure how one modifies the axes to have logarithmic scales.  The "loglog()" version of "plot()" is a builtin, so I can't see how it's done there.  I have already made my own "delayedcomet.m" to slow it down (just copying the original comet.m and inserting a pause()).  However, "axis" doesn't seem to have access to log scale.  Any suggestions?

Thanks for any help from an older MATLAB newbie.

Doug Anderson
```
 0
1/31/2012 3:27:10 AM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader.

1 Replies
866 Views

Similar Articles

[PageSpeed] 33

```
"Douglas Anderson" <andersondou@pbworld.com> wrote in message
news:jg7n2e\$q87\$1@newscl01ah.mathworks.com...
> I would like to create a log-log comet plot, and am not sure how one
> modifies the axes to have logarithmic scales.  The "loglog()" version of
> "plot()" is a builtin, so I can't see how it's done there.  I have already
> made my own "delayedcomet.m" to slow it down (just copying the original
> comet.m and inserting a pause()).  However, "axis" doesn't seem to have
>
> Thanks for any help from an older MATLAB newbie.
>
> Doug Anderson

ax = axes;
set(ax, 'XScale', 'log', 'YScale', 'log', 'NextPlot', 'replacechildren');
t = -pi:pi/200:pi;
comet(ax, t,tan(sin(t))-sin(tan(t)))

Line 2 tells MATLAB to make the X and Y axes both use log scale, and tells
it to replace any lines etc. on the axes the next time something tries to
plot onto the axes rather than resetting almost all the properties
(including XScale and YScale.)

Note you'll receive warnings when you run this example; that's due to the
negative values in t. The example included in the help text for COMET wasn't
designed with logarithmic scale comet plotting in mind. When run with your
real data (which presumably doesn't contain negative values) it shouldn't
warn.

--
Steve Lord
slord@mathworks.com