Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab直方图中垂直线的标题/标签_Matlab_Histogram_Legend_Caption - Fatal编程技术网

Matlab直方图中垂直线的标题/标签

Matlab直方图中垂直线的标题/标签,matlab,histogram,legend,caption,Matlab,Histogram,Legend,Caption,我使用Matlab在直方图中绘制一些收益。我希望通过一条垂直线看到图中的0.005分位数,这与以下代码一起工作 q = 0.995; MSCIq = quantile(MSCIan, 1-q) nbins = 50; histMSCI = histogram(MSCIan, nbins) xlabel('MSCI') ylabel('count') title('test') line([MSCIq MSCIq], ylim, 'Color', 'r') 我想用文本和MSCIq的值来标记垂

我使用Matlab在直方图中绘制一些收益。我希望通过一条垂直线看到图中的0.005分位数,这与以下代码一起工作

q = 0.995;
MSCIq = quantile(MSCIan, 1-q)

nbins = 50;
histMSCI = histogram(MSCIan, nbins)
xlabel('MSCI')
ylabel('count')
title('test')
line([MSCIq MSCIq], ylim, 'Color', 'r')

我想用文本和MSCIq的值来标记垂直线。(假设MSCIq=-0.44,那么我想要类似“风险价值=-0.44”)。直接在直线上或以图例的形式。
有人知道怎么做吗?

谢谢@SpamBot,但这对我不起作用。没有错误,但也没有标题。此外,如果值发生变化,有没有办法用变量MSCIq替换“-0.44”?!非常感谢。Use可以使用
sprintf
从值生成字符串参数。另外,请调整坐标100300。
hold on;
text(100, 300, 'MSCIq= -0.44');
hold off;