---
title: "init(x:y:z:function:)"
framework: charts
role: symbol
role_heading: Initializer
path: "charts/surfaceplot/init(x:y:z:function:)-6c5e6"
---

# init(x:y:z:function:)

Creates a SurfacePlot that represents a function y = f(x, z).

## Declaration

```swift
nonisolated init(x: LocalizedStringKey, y: LocalizedStringKey, z: LocalizedStringKey, function: @escaping @Sendable (Double, Double) -> Double)
```

## Parameters

- `x`: The x label.
- `y`: The y label.
- `z`: The z label.
- `function`: The function to graph.

## Discussion

Discussion note: For x and z value pairs where the function is undefined or is infinity, the function is expected to return Double.nan
