如何创建 3D 散点图? [英] How to create a 3D scatter plot?

查看:32
本文介绍了如何创建 3D 散点图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在用 C# 研究 3d 散点图.到目前为止,我找到了一个对我有用的 .但是,不一定像我需要的那样灵活.由于我所需要的只是创建一个固定的 3D 散点图,是否还有其他替代方法可以使用 C# 中的 Point3D 结构或任何其他不需要我引入 3rd 方库的替代方法来进行 3d 绘图?这可能会带来更好的灵活性?

I have been doing some research on 3d scatter plots with C#. So far I have found a library that is somewhat working for me. However, not necessarily as flexible as I need it to be. Since all I require is to create a fixed 3D scatter plot, are there other alternatives to 3d plotting using the Point3D structure in C# or any other alternatives that don't require me bringing in a 3rd party library and that might allow for better flexibility?

推荐答案

我已经成功地使用 ILNumerics<创建了一个 3D 散点图/a>:

I've managed to create a 3D scatter plot with ILNumerics:

var colors
  = new[] { Color.Red, Color.Black, Color.Blue, Color.Green /*...*/ };

ILArray<float> data = ILMath.zeros<float>(
  3,
  colors.Length);

ILArray<float> colorData = ILMath.zeros<float>(
  3,
  colors.Length);

int index = 0;
foreach (var p in colors)
{
  data[0, index] = p.GetHue();
  data[1, index] = p.GetSaturation();
  data[2, index] = p.GetBrightness();
  colorData [0, index] = p.R / 255.0f;
  colorData [1, index] = p.G / 255.0f;
  colorData [2, index] = p.B / 255.0f;
  index++;
}

var points = new ILPoints()
{
  Positions = data,
  Colors = colorData 
};

points.Color = null;

var plot = new ILPlotCube(twoDMode: false)
{
  Rotation = Matrix4.Rotation(new Vector3(1, 1, 0.1f), 0.4f),
  Projection = Projection.Orthographic,
  Children = { points }
};

plot.Axes[0].Label.Text = "Hue";
plot.Axes[1].Label.Text = "Saturation";
plot.Axes[2].Label.Text = "Brightness";

this.ilPanel1.Scene = new ILScene { plot };

很容易学习和使用,但是我的显卡有一些严重的问题(它是 Intel® Processor Graphics 2000 所以我不怪他们......) - 只有 GDI 渲染器是工作,表现不是很惊人.

Quite easy to learn and use, however has some serious problems with my graphics card (it's Intel® Processor Graphics 2000 so I don't blame them...) - only the GDI renderer is working, with not very astonishing performance.

这篇关于如何创建 3D 散点图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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