如何创建3D散点图? [英] How to create a 3D scatter plot?
问题描述
我一直在使用C#对3d散点图进行一些研究。到目前为止,我已经找到了一个对我有用的库。但是,不一定像我需要的那样灵活。由于我只需要创建一个固定的3D散点图,是否有其他替代方法可以使用C#中的 Point3D
结构或不需要我携带的其他任何替代方法
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?
推荐答案
我已经成功地创建了一个3D散点图,其中< a href = http://ilnumerics.net/ rel = nofollow> ILNumerics :
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 };
易于学习和使用,但是我的图形卡存在一些严重问题(它是英特尔®处理器图形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屋!