Matlab cdfplot:如何控制标记间距
我有一个 Matlab 图形,我想在论文中使用。该图包含多个 cdf 图。 现在的问题是我无法使用标记,因为标记在图中变得非常密集。 如果我想让样本稀疏,我必须从 cdfplot 中删除一些样本,这将导致不同的 cdfplot 线。
如何在保持实际线条的同时添加足够的标记?
I have a Matlab figure I want to use in a paper. This figure contains multiple cdfplots.
Now the problem is that I cannot use the markers because the become very dense in the plot.
If i want to make the samples sparse I have to drop some samples from the cdfplot which will result in a different cdfplot line.
How can I add enough markers while maintaining the actual line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
一种方法是按照 @ephsmith 的解决方案 (1) 从曲线中获取 XData/YData 属性并将其设置回来。这是一条曲线的示例。
另一种方法是使用 ECDF 函数单独计算经验 CDF,然后减少使用 PLOT 绘图之前的结果。
结果
One method is to get XData/YData properties from your curves follow solution (1) from @ephsmith and set it back. Here is an example for one curve.
Another method is to calculate empirical CDF separately using ECDF function, then reduce the results before plotting with PLOT.
Result
我知道考虑到 MATLAB 的内置函数(无论如何在统计工具箱中),这可能是不必要的,但它可能对无法访问该工具箱的其他查看者有用。
经验CMF(CDF)本质上是经验PMF的累积和。后者可以在 MATLAB 中通过
hist
函数实现。为了获得经验 PMF 的良好近似值,必须适当选择 bin 的数量。在下面的示例中,我假设 64 个 bin 对于您的数据来说已经足够了。现在您可以使用 yuk 给出的简化数据示例来选择要绘制的点数量。
I know this is potentially unnecessary given MATLAB's built-in functions (in the Statistics Toolbox anyway) but it may be of use to other viewers who do not have access to the toolbox.
The empirical CMF (CDF) is essentially the cumulative sum of the empirical PMF. The latter is attainable in MATLAB via the
hist
function. In order to get a nice approximation to the empirical PMF, the number of bins must be selected appropriately. In the following example, I assume that 64 bins is good enough for your data.Now you can choose how many points you'd like to plot by using the reduced data example given by yuk.
很简单......
verry simple.....
尝试减小标记大小。
try reducing the marker size.
出于发布目的,我倾向于使用图形窗口上的绘图工具。这允许您调整所有绘图参数并立即看到结果。
如果问题是您的数据点太多,您可以:
1)。使用数据的每第 n 个样本进行绘图。尝试找到一个能够产生您想要的外观的 n。
2)。我通常将曲线拟合到我的数据中,并在拟合图中添加一些稀疏放置的标记来区分曲线。
For publishing purposes I tend to use the plot tools on the figure window. This allow you to tweak all of the plot parameters and immediately see the result.
If the problem is that you have too many data points, you can:
1). Plot using every nth sample of the data. Experiment to find an n that results in the look you want.
2). I typically fit curves to my data and add a few sparsely placed markers to plots of the fits to differentiate the curves.
老实说,出于发布目的,我总是发现选择不同的
'LineStyle '
或'LineWidth'
属性提供了更清晰的结果。这也比尝试对数据进行下采样要容易得多,对于使用 制作的图来说,这也容易得多CDFPLOT 我发现标记只是遮挡了线条的阶梯性质。Honestly, for publishing purposes I have always found that choosing different
'LineStyle'
or'LineWidth'
properties for the lines gives much cleaner results than using different markers. This would also be a lot easier than trying to downsample your data, and for plots made with CDFPLOT I find that markers simply occlude the stairstep nature of the lines.