LevelScheme中的直方图 [英] Histogram plots in LevelScheme

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

问题描述

我刚刚开始使用 LevelScheme ,并且在获取直方图时遇到问题正确地放置在图中.一个最小的无效示例:

I've just started using LevelScheme, and have issues with getting the histogram to fit correctly within the figure. A minimal non-working example:

<<"LevelScheme`"
Figure[{FigurePanel[{{0, 1}, {0, 1}},
   LabB -> textit["x"], BufferB -> 2.5,
   LabL -> textit["p(x)"], BufferL -> 2.5,
   FrameTicks -> {LinTicks[-4, 4], LinTicks[0, 1]},
   PlotRange -> {{-3, 3}, {0, 0.5}}], 
  RawGraphics[
   Histogram[RandomReal[NormalDistribution[], 1000], Automatic, 
    "ProbabilityDensity"]]},
 Frame -> False, PlotRange -> {{-0.075, 1.1}, {-0.1, 1.03}}]

输出看起来像这样

什么时候看起来应该像这样

when it should look like this

基本上,Histogram图形对象不服从FigurePanelPlotRange,而是服从主FigurePlotRange.当Histogram替换为Plot或类似命令时,不会发生此现象.因此,以下内容将产生清晰的情节

Basically, the Histogram graphics object doesn't obey the FigurePanel's PlotRange, but instead obeys the main Figure's PlotRange. This behaviour doesn't occur when the Histogram is replaced by a Plot or similar commands. So the following produces a clean plot

Figure[{FigurePanel[{{0, 1}, {0, 1}},
   LabB -> textit["x"], BufferB -> 2.5,
   LabL -> textit["p(x)"], BufferL -> 2.5,
   FrameTicks -> {LinTicks[-4, 4], LinTicks[0, 1]},
   PlotRange -> {{-3, 3}, {0, 0.5}}], 
  RawGraphics[Plot[1/Sqrt[2 Pi] Exp[-x^2/2], {x, -4, 4}]]},
 Frame -> False, PlotRange -> {{-0.075, 1.1}, {-0.1, 1.03}}]

还有其他人遇到过此问题吗?或者,您对修复有何建议?

Has anyone else encountered this issue? Or, do you have suggestions for a fix?

编辑

我想我要在问题中添加一些绿色.我仍然对知道如何克服这一障碍感兴趣.

I thought I'd add some green to the question. I'm still interested in knowing how to overcome this hurdle.

推荐答案

好吧,我想您不太喜欢这个,但这是一种解决方法.

Well, I recon you won't like this one too much but it is a workaround of sorts.

如果我给PerformanceGoal -> "Speed"作为直方图选项(而不是PerformanceGoal -> "Quality"),则禁用了交互行为,但是经过一些细微调整,我得到了以下信息:

If I give PerformanceGoal -> "Speed" as a Histogram option (rather than PerformanceGoal -> "Quality") I disable interactive behaviour but, with a few minor tweaks, I get the following:

<< "LevelScheme`"
Figure[{FigurePanel[{{0, 1}, {0, 1}}, LabB -> textit["x"], 
   BufferB -> 2.5, LabL -> textit["p(x)"], BufferL -> 2.5, 
   FrameTicks -> {LinTicks[-4, 4], LinTicks[0, 1]}, 
   PlotRange -> {{-3, 3}, {0, 0.55}}], 
  RawGraphics[
   Histogram[RandomReal[NormalDistribution[], 1000], Automatic, 
    "ProbabilityDensity", PerformanceGoal -> "Speed"]]}, 
 Frame -> False, PlotRange -> {{-0.075, 1.1}, {-0.15, 1.1}}]

这篇关于LevelScheme中的直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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