在MATLAB的茎图中删除零值的圆 [英] Remove circles for zero values in a stem plot in MATLAB

查看:62
本文介绍了在MATLAB的茎图中删除零值的圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 MATLAB 中用茎图绘制一些离散值.我发现如果该值为零,则词干图将在x轴上放置一个圆圈以显示零.如果值为零,是否有一种方法可以使茎不显示圆呢?

I am plotting some discrete values with a stem plot in MATLAB. I found that if the value is zero, the stem plot will put a circle on the x axis to show the zeros. Is there a way to have a stem NOT showing the circles if the value is zero?

推荐答案

将它们视为 NaN,即:

Treat them as NaN's, ie:

Y = [1;2;3;0;3;2;4;0;1];
Y(Y == 0) = NaN;
stem(Y);

第4个和第8个索引将仍然存在于x轴上,但是如果将观察值设置为 NaN ,则不会绘制任何线或圆.

The 4th and 8th index will still exist on the x-axis, but if the observation is set to NaN, no line or circle will be plotted.

这篇关于在MATLAB的茎图中删除零值的圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆