从给定角度看 Histogram3D 的 2D 坐标

发布于 2024-12-07 14:12:40 字数 304 浏览 1 评论 0原文

在此处输入图像描述

我在网上找到了该图。我不知道哪种分布会产生这种结果。我想在纸上画出这样的情节。但如果可能的话,请从 Mathematica 获得一些帮助:

以该图像为例,我可以获得绘图中每个可见条形边缘的 2D 坐标吗?

我不知道这是否纯粹是从绘图中检测图像的边缘,或者我们是否可以从绘图本身获取此信息。

理想情况下,我会调整图像尺寸以匹配我的纸张尺寸并获得缩放后的坐标。这将是令人难以置信的。

感谢您的关注。

enter image description here

I found that plot on the web. I don`t know which kind of Distribution yields this. I would like to draw such plot on paper. But get some help from Mathematica if possible :

With this image as example could I obtain the 2D coordinate of each visible bar edges of the plot?

I don`t know if it is purely edge detection of an image from a plot or if we could get this info from the plot itself.

Ideally I would adjust the image size to match my paper size and obtain the coordinates scaled. It would be incredible.

Thank You for your attention.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

┼── 2024-12-14 14:12:40

@500 如果您只是想手动绘制这样的图,请将其捕获并将其作为模板带入绘图程序中。然后在网格线打开的情况下在不同的图层上绘制它;最后,取出图片并打印。将其缩放到您想要的任何大小是一件容易的事。但如果您想探索 Mathematica 如何使用它,请继续阅读。


看来您需要使用 Histogram3D。 (请参阅文档。)

让我们生成正态分布的数据点 (n= 10k)平均值约为 40 和 125,标准差分别为 10 和 50,Spearman rho 为 0.45。

data = RandomVariate[BinormalDistribution[{40, 125}, {10, 50}, .45],  10^4]

如果您愿意,您可以从 FullForm 获取数据。这将为您提供 z 值。

让我们使用 Histogram3D 绘制它。我们将分别使用宽度为 5 和 25 的 bin 来表示 x、y。

Histogram3D[data2, {{Table[10 + 5 k, {k, 15}]}, {Table[ 0 + 25 k, {k, 0, 12}]}}]

Histogram3D


编辑:

当您将鼠标悬停在条形上时,z 值将显示在工具提示中。因此,如果您想“手动”收集数据,您可以这样做。或者,使用 FullForm 您可以查找如下所示的 List,其中似乎包含您要查找的坐标。它们似乎位于 CuboidBox 后面的 List 中,但它们可能是 CuboidBox 参数。有人应该能够澄清这一点。

List[Tooltip[
  StatusArea[
  List[RawBoxes[
  DynamicBox[
  List[FEPrivate`If[CurrentValue["MouseOver"], 
    EdgeForm[
     List[RGBColor[0.6666666666666666`, 0.6666666666666666`, 
       0.6666666666666666`], AbsoluteThickness[1.5`]]], List[], 
       List[]], 
       CuboidBox[List[15.`, 0.`, 0.`], List[20.`, 25.`, 10.`]]]]]], 
       10.`], Style[10.`, List[GrayLevel[0]]]]]

您还可以使用 LabelingFunction 来显示 z 值,但这看起来不太好,除非您垂直于 xy 平面查看,在这种情况下,最好使用 DensityPlot代码>.

Histogram3D[data2, {{Table[10 + 5 k, {k, 15}]}, 
  {Table[0 + 25 k, {k, 0, 12}]}}, 
  LabelingFunction -> (Placed[Panel[#1, FrameMargins -> 0], Above] &)]

@500 If you simply want to draw a plot like this by hand, capture it and bring it into a drawing program as a stencil. Then draw over it on a different layer, while gridlines are on; finally, remove the picture and print it. It's an easy job to scale it to whatever size you wish. But it you want to explore how Mathematica works with it, read on.


Looks like you'll want to be using Histogram3D. (See documentation.)

Let's generate normally distributed data points (n= 10k) around means of 40 and 125 with standard deviations of 10 and 50, respectively and a Spearman rho of .45.

data = RandomVariate[BinormalDistribution[{40, 125}, {10, 50}, .45],  10^4]

You may grab data from FullForm if you like. That will give you the z-values.

Let's plot it using Histogram3D. We'll use bins of width 5 and 25 for x, y, respectively.

Histogram3D[data2, {{Table[10 + 5 k, {k, 15}]}, {Table[ 0 + 25 k, {k, 0, 12}]}}]

Histogram3D


Edit:

When you mouse over a bar, the z-value will appear in a tooltip. So if you want to gather the data "by hand", you can do it that way. Alternatively, using FullForm you can look for Lists such as the following, which appear to contain the coordinates you are looking for. They appear to be in the List following CuboidBox but they may be the CuboidBox parameters. Someone should be able to clarify this.

List[Tooltip[
  StatusArea[
  List[RawBoxes[
  DynamicBox[
  List[FEPrivate`If[CurrentValue["MouseOver"], 
    EdgeForm[
     List[RGBColor[0.6666666666666666`, 0.6666666666666666`, 
       0.6666666666666666`], AbsoluteThickness[1.5`]]], List[], 
       List[]], 
       CuboidBox[List[15.`, 0.`, 0.`], List[20.`, 25.`, 10.`]]]]]], 
       10.`], Style[10.`, List[GrayLevel[0]]]]]

You could also use LabelingFunction to display the z-values, but this will not look good unless you are looking perpendicular to the x-y plane, in which case it might be better to use DensityPlot.

Histogram3D[data2, {{Table[10 + 5 k, {k, 15}]}, 
  {Table[0 + 25 k, {k, 0, 12}]}}, 
  LabelingFunction -> (Placed[Panel[#1, FrameMargins -> 0], Above] &)]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文