[英]ILNumerics plot 2d chart
您好,我在ILArray <double>中保存了二维矩阵数据。 这个矩阵代表了一个神经元的神经网络的权重,我想看一下权重用数字或数字表示的样子。 知道我该怎么做吗? 我发现了很多用于3D绘图的示例,但是却找不到用于绘制2D图像数据表示的示例。
当前,通过使用ILSurface可以最佳(最简单)地显示图像数据。 由于这是3D图,因此对于大图像数据可能无法获得最佳性能。 幸运的是,ILNumerics的场景图使您可以轻松地通过自己的实现对其进行改进。
最简单的尝试将采用ILPoints形状,在网格中排列所需数量的点,然后让每个点可视化输入矩阵中相应元素的值-假设按颜色(或大小)表示。
private void ilPanel1_Load(object sender, EventArgs e) {
using (ILScope.Enter()) {
// some 'input matrix'
ILArray<float> Z = ILSpecialData.sincf(40, 50);
// do some reordering: prepare vertices
ILArray<float> Y = 1, X = ILMath.meshgrid(
ILMath.vec<float>(1, Z.S[1]),
ILMath.vec<float>(1,Z.S[0]),
Y);
// reallocate the vertex positions matrix
ILArray<float> pos = ILMath.zeros<float>(3, X.S.NumberOfElements);
// fill in values
pos["0;:"] = X[":"];
pos["1;:"] = Y[":"];
pos["2;:"] = Z[":"];
// colormap used to map the values to colors
ILColormap cmap = new ILColormap(Colormaps.Hot);
// setup the scene
ilPanel1.Scene.Add(new ILPlotCube {
new ILPoints() {
Positions = pos,
Colors = cmap.Map(Z).T,
Color = null
}
});
}
}
显然,结果点不随表单缩放。 因此,当表单尺寸增加时,“图像”会在两点之间产生较大的间隙。 因此,为了更好的实现,您可以调整该方法以利用ILTriangles
代替ILPoints
,以便组装相邻的矩形。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.