<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGContext/translateBy(x:y:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "c:@F@CGContextTranslateCTM"
  },
  "title" : "translateBy(x:y:)"
}
-->

# translateBy(x:y:)

Changes the origin of the user coordinate system in a context.

```
func translateBy(x tx: CGFloat, y ty: CGFloat)
```

## Parameters

`tx`

The amount to displace the x-axis of the coordinate space, in units of the user space, of the specified context.

`ty`

The amount to displace the y-axis of the coordinate space, in units of the user space, of the specified context.

## Discussion

---

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)