[英]Matlab scatterhist plots - display only one histogram
In Matlab, I want to plot data as a scatter plot, and display the marginal histogram at the side of one axis only . 在Matlab中,我想将数据绘制为散点图,并仅在一个轴的侧面显示边缘直方图。
I came across the scatterhist() function, which does exactly what I was looking for, except it always displays marginal histograms for both X and Y axes . 我遇到了scatterhist()函数,它正是我正在寻找的,除了它总是显示 X和Y轴的边缘直方图。 Surely there's a way to remove one, but can't find the options.
当然有一种方法可以删除一个,但找不到选项。
My code as an example: 我的代码作为例子:
h = scatterhist(xrange, ydata, ...
'Kernel','on', 'Location', 'SouthEast', ...
'Direction','out', 'Marker','.');
An image of my problem is below (I am using the kernel density line instead of the actual histogram): 我的问题的图像如下(我使用的是内核密度线而不是实际的直方图):
Note: I am able to open the property editor for the figure and manually remove a histogram by clicking and deleting, and furthermore access the source code for that modified figure, but this doesn't seem to provide me with a solution. 注意:我可以打开图形的属性编辑器,通过单击和删除手动删除直方图,然后访问该修改后的图形的源代码,但这似乎并没有为我提供解决方案。
Thank you! 谢谢!
The function scatterhist
creates three axes. 函数
scatterhist
创建三个轴。 Calling it as h = scatterhist(...)
gives a 1×3 vector h
with handles to those axes. 将其称为
h = scatterhist(...)
给出1×3向量h
其中包含这些轴的句柄。 You only need to delete the second: 您只需要删除第二个:
h = scatterhist(...);
delete(h(2))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.