From: Timi on
Is there a way to label each stem on a stem plot? For example suppose the magnitude of each stem represented something, if I store what each magnitude represents, is there are way to output that on top of each stem in the plot? thanks
From: Walter Roberson on
Timi wrote:
> Is there a way to label each stem on a stem plot? For example suppose
> the magnitude of each stem represented something, if I store what each
> magnitude represents, is there are way to output that on top of each
> stem in the plot? thanks

Xd = get(StemHandle, 'XData');
Yd = get(StemHandle, 'YData');
for K = 1 : length(Xd)
text(Xd(K), Yd(K) * 1.1, Stemlabel{K}, 'HorizontalAlignment', 'center');
end


Note: this places each label 10% further than the y value, which is probably
not exactly what you want (e.g., consider 0, and consider negative numbers).
You can work out an appropriate offset somehow using min(Yd) and max(Yd) .
From: Timi on
Awesome!! Thanks

For those that want to do this, grab the assign StemHandle a value Stemlabel(K) should be text of label u want to insert at K


Walter Roberson <roberson(a)hushmail.com> wrote in message <hum6va$5iv$1(a)canopus.cc.umanitoba.ca>...
> Timi wrote:
> > Is there a way to label each stem on a stem plot? For example suppose
> > the magnitude of each stem represented something, if I store what each
> > magnitude represents, is there are way to output that on top of each
> > stem in the plot? thanks
>
> Xd = get(StemHandle, 'XData');
> Yd = get(StemHandle, 'YData');
> for K = 1 : length(Xd)
> text(Xd(K), Yd(K) * 1.1, Stemlabel{K}, 'HorizontalAlignment', 'center');
> end
>
>
> Note: this places each label 10% further than the y value, which is probably
> not exactly what you want (e.g., consider 0, and consider negative numbers).
> You can work out an appropriate offset somehow using min(Yd) and max(Yd) .
From: Walter Roberson on
Timi wrote:

> For those that want to do this, grab the assign StemHandle a value
> Stemlabel(K) should be text of label u want to insert at K

Not exactly: Stemlabel(K) should be a cell containing the text of the label.
Stemlabel{K} would be the text.


> Walter Roberson <roberson(a)hushmail.com> wrote in message

>> text(Xd(K), Yd(K) * 1.1, Stemlabel{K}, 'HorizontalAlignment',
>> 'center');