XPlot
XPlot copied to clipboard
How to name z-axis in a C# application
I am trying to generate a 3D plot from a C# application. For some reason the code below does not work because the "layout" does not contain a zaxis definition (it does for xaxis and yaxis). If I comment the part about the zaxis title naming, I get the plot I want, however the x and y axis aren't named at all, and the pad for the margin does nothing. When I remove the z data and simply have a 2D plot, all of the above issues go away and it works as expected. Can someone guide me here, and is there a nice C# documentation available? All I can find is F# documentation.
int[] x1 = new int[4] { 1, 2, 3, 4 };
int[] y1 = new int[4] { -2, -3, -4, -5 };
int[] z1 = new int[4] { 3, 4, 5, 6 };
int[] x2 = new int[4] { 11, 12, 13, 14 };
int[] y2 = new int[4] { 12, 13, 14, 15 };
int[] z2 = new int[4] { 13, 14, 15, 16 };
var chart2_list = new List<Scatter3d>
{
new Scatter3d
{
x = x1,
y = y1,
z = z1,
name="Sensor",
mode = "markers"
},
new Scatter3d
{
x = x2,
y = y2,
z = z2,
name="Magnet",
mode = "markers"
}
};
var chart2 = Chart.Plot(chart2_list);
var chart2_layout = new Layout.Layout
{
title = "Magnet and Sensor",
xaxis = new Xaxis
{
title = "Inclination"
},
yaxis = new Yaxis
{
title = "Azimuth"
},
zaxis = new Zaxis
{
title = "bla"
},
width = 1500,
height = 800,
margin = new Margin
{
pad = 5000
},
//zaxis = new Zaxis
//{
// title = "Elevation"
//}
};
chart2.WithLayout(chart2_layout);
chart2.Show();