Code examples explaining how to set up 3D scatter plots.
Refer to What is a 3D Scatter Plot? for a map 3D scatter plot presentation.
Create and Configure a 3D Scatter Plot
public static void Create3DScatterPlot(AnalysisApplication application)
{
// Add a scatter plot to the page
ScatterPlot3D plot = application.Document.ActivePageReference.Visuals.AddNew<ScatterPlot3D>();
plot.Title = "3D Scatter Plot";
// Connect the scatterplot to data
DataManager dataManager = application.Document.Data;
plot.Data.DataTableReference = dataManager.Tables.DefaultTableReference;
// Set filtering for the visualization
plot.Data.UseActiveFiltering = true;
// Set marking for the visualization
plot.Data.MarkingReference = dataManager.Markings.DefaultMarkingReference;
// Marker By
plot.MarkerByAxis.Expression = "<baserowid()>"; // one marker per row in the dataset
// X Axis
plot.XAxis.Expression = "Cost";
// Y Axis
plot.YAxis.Expression = "Sales";
// Y Axis
plot.ZAxis.Expression = "Volume";
// Color By
plot.ColorAxis.Expression = "<Type>";
// Shape by Category column, and set shape for individual categories.
plot.ShapeAxis.Expression = "<Category>";
plot.ShapeAxis.ShapeMap["Fruit"] = Shapes3D.Sphere;
plot.ShapeAxis.ShapeMap["Vegetables"] = Shapes3D.Diamond;
// Set the camera paramaters to something else than default.
// The data is mapped to a box with a side length of 1, centered
// at the origin. We use the fields of view property to figure
// out a good camera distance.
double distance = 0.7 / Math.Tan((plot.Camera.FieldOfView / 2) * Math.PI / 180);
plot.Camera.Position = new Tuple3D(distance, distance, distance);
plot.Camera.Direction = new Tuple3D(-distance, -distance, -distance);
plot.Camera.UpDirection = new Tuple3D(0, 1, 0); // Y is up
}