<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Charts",
  "identifier" : "/documentation/Charts/SurfacePlot/init(x:y:z:function:)-2dqgp",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift Charts"
    ],
    "preciseIdentifier" : "s:6Charts11SurfacePlotV1x1y1z8functionAC7SwiftUI4TextV_A2JS2d_SdtYbctcfc"
  },
  "title" : "init(x:y:z:function:)"
}
-->

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

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

```
nonisolated init(x: Text, y: Text, z: Text, 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> Note: For x and z value pairs where the function is undefined or is infinity,
> the function is expected to return `Double.nan`

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)