# comet3

3-D comet plot

## Syntax

``comet3(z)``
``comet3(x,y,z)``
``comet3(x,y,z,p)``
``comet3(ax,x,y,z,p)``

## Description

````comet3(z)` displays a comet plot of the data specified in `z` versus `x`- and `y`-values matching the indices of `z`. A comet is an animation of a marker (head) and a line (tail) tracing a growing line over the data points. The tail is a solid line that traces the entire function.```

example

````comet3(x,y,z)` displays a comet plot of `z` versus `x` and `y`.```

example

````comet3(x,y,z,p)` specifies the comet body length. The comet body is a trailing segment in a different color that follows the head before fading. The body length is `p*length(y)`, where p is a scalar in [0, 1).```

example

````comet3(ax,x,y,z,p)` plots the comet into the axes specified by `ax`.```

## Examples

collapse all

Create a comet plot of the data in `z` versus the data in `x` and `y`. Use the `peaks` function to load `x`, `y`, and `z` data in matrix forms. Convert the data into vector arrays. Then, plot the data.

```[xmat,ymat,zmat] = peaks(100); xvec = xmat(:); yvec = ymat(:); zvec = zmat(:); comet3(xvec,yvec,zvec)``` Create a comet plot and specify the comet body length by setting the scale factor input `p`. The comet body is a trailing segment in a different color that follows the head before fading.

Use the `peaks` function to load `x`, `y`, and `z` data in matrix forms. Convert the data into vector arrays. Specify `p` as `0.5` so that the body length is `0.5*length(y)`. Then, plot the data.

```[xmat,ymat,zmat] = peaks(100); xvec = xmat(:); yvec = ymat(:); zvec = zmat(:); p = 0.5; comet3(xvec,yvec,zvec,p)``` Create two comet plots in a tiled chart layout by specifying the target axes for each plot.

Use the `peaks` function to load `x`, `y`, and `z` data in matrix forms. Convert the data into vector arrays. Specify the body length scale factor `p` as `0.25` so that the body length is `0.5*length(y)`.

```[xmat,ymat,zmat] = peaks(50); xvec = xmat(:); yvec = ymat(:); zvec = zmat(:); p = 0.25;```

Store the two `Axes` objects as `ax1` and `ax2`. Specify the target axes for each comet plot by including the `Axes` object as the first input argument to `comet`.

```tiledlayout(1,2); ax1 = nexttile; ax2 = nexttile; comet3(ax1,xvec,yvec,zvec,p) comet3(ax2,yvec,xvec,zvec,p)``` ## Input Arguments

collapse all

z-values, specified as a vector. To plot against specific x- and y-values you must also specify `x` and `y`.

x-values, specified as a vector. `x`, `y`, and `z` must be the same size. If you specify geographic axes for `ax`, then `x` represents latitude in degrees.

y-values, sp0ecified as a vector. `x`, `y`, and `z` must be the same size. If you specify geographic axes for `ax`, then `y` represents longitude in degrees.

Comet body length scale factor, specified as a value in the interval [0, 1). The comet body length is `p*length(y)`.

Target axes, specified as an `Axes` object or `GeographicAxes` object.

## Limitations

• Comet plots do not support data tips.
{"ft_lang_label":"__label__en","ft_lang_prob":0.83759826,"math_prob":0.997851,"size":479,"snap":"2020-45-2020-50","text_gpt3_token_len":126,"char_repetition_ratio":0.13263159,"word_repetition_ratio":0.0,"special_character_ratio":0.24425887,"punctuation_ratio":0.10280374,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99748147,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-24T07:33:10Z\",\"WARC-Record-ID\":\"<urn:uuid:8a0ba183-74f9-48f4-8d8e-bd2bc9c05fe1>\",\"Content-Length\":\"93727\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ee876f3d-d531-4391-bb37-eb40c312ae32>\",\"WARC-Concurrent-To\":\"<urn:uuid:f449a87f-015a-49be-83ad-4e9ab7be1375>\",\"WARC-IP-Address\":\"184.25.198.13\",\"WARC-Target-URI\":\"https://in.mathworks.com/help/matlab/ref/comet3.html\",\"WARC-Payload-Digest\":\"sha1:D6JCSR6HHQI6FCX4GGPQ4FIL4JUQK7TS\",\"WARC-Block-Digest\":\"sha1:AORIILKIX4JXWTKSJKOD6TVL7OVJ5FMX\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141171126.6_warc_CC-MAIN-20201124053841-20201124083841-00715.warc.gz\"}"}