Reputation: 173
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?
Upvotes: 4
Views: 8968
Reputation: 31
Assuming you don't need the plot to appear in your your C# application, I can suggest HypnoLog, an Open source tool I been working on which will display the plot in a web browser acting as an output log.
The advantages over the ILNumerics
library which was suggested in the other answer are:
Point3D
)There is no built-in visualizer for 3d scatter plot right now in HypnoLog, but you can easily create your own visualizer. I can suggest using plotly 3D Scatter Plots. HypnoLog will help you sending the data from your C# application to the visualizer you created in the browser. See HypnoLog-CSharp library for easy use of HypnoLog in C#.
Upvotes: 1
Reputation: 35891
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 };
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.
Upvotes: 3