Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to name z-axis in a C# application #174

Open
cjolinla19 opened this issue Nov 30, 2021 · 0 comments
Open

How to name z-axis in a C# application #174

cjolinla19 opened this issue Nov 30, 2021 · 0 comments

Comments

@cjolinla19
Copy link

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant