Mathematica 中没有垂直线的直方图
我正在尝试制作没有垂直线的直方图。我想要一个看起来像函数的图。像这样:
之前曾对 R 提出过同样的问题 ( 没有垂直线的直方图)但我在 Mathematica 上。
我一直在研究 ChartStyle
选项,但没有成功。
I am trying to make an histogram without vertical lines. I'd like to have a plot which looks like a function. Like this:
The same question has been asked for R before ( histogram without vertical lines ) but I'm on Mathematica.
I have been looking into the ChartStyle
options without success.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您还可以将
ListPlot
与InterpolationOrder->0
一起使用:You could also use
ListPlot
withInterpolationOrder->0
:可能有多种方法可以通过摆弄
Histogram
中的EdgeForm[]
和FaceForm[]
来做到这一点,但我发现滚动起来更简单每当我需要时,我就可以使用它。这是一个非常简单快速的示例:执行
histPlot[RandomReal[NormalDistribution[],{1000}],{-3,3,0.1}]
给出然后,您可以扩展此选项以采用任何选项,而不仅仅是
"PDF"
,并且适用于以下情况您想自动选择垃圾箱。我不喜欢自动分箱,因为我喜欢控制分箱宽度和范围,以实现可预测性并轻松与其他图进行比较。There probably are ways to do this by fiddling with
EdgeForm[]
andFaceForm[]
inHistogram
, but I've found it simpler to roll one on my own, whenever I need it. Here's a very simple and quick example:Doing
histPlot[RandomReal[NormalDistribution[],{1000}],{-3,3,0.1}]
givesYou can then extend this to take any option instead of just
"PDF"
, and for cases when you'd like to choose the bins automatically. I dislike automatic binning, because I like to control my bin widths and extents for predictability and easy comparison against other plots.以下是在版本 7 中使用后处理的两种方法:
Here are two methods that work in version 7, using post-processing: