Opened 6 years ago

# Transformations for 2D plots

Reported by: Owned by: nthiery major sage-6.4 graphics slelievre N/A

Implement transform, rotate, translate, ... for 2D plots analoguously to their 3D counterparts.

Requested on

### comment:1 follow-up: ↓ 2 Changed 6 years ago by kcrisman

Do you have some links for examples of syntax or functionality from other programs? That could be helpful to anyone trying to do this - right now it's somewhat vague. I like the idea.

### comment:2 in reply to: ↑ 1 Changed 6 years ago by nthiery

Do you have some links for examples of syntax or functionality from other programs? That could be helpful to anyone trying to do this - right now it's somewhat vague. I like the idea.

I had in mind the same syntax as for plot3d (up to the obvious adaptations), so that one could write dimension-agnostic code whenever possible. Here are some things you can do with them:

```sage: p =  plot3d(lambda x, y: x^2 + y^2, (-2,2), (-2,2))
sage: p.translate(<vector>)
sage: p.rotateX(<angle>)
sage: p.scale(3)
sage: p.transform(rotate=..., scale=..., translate=...)
sage: p.transform(<matrix>)
sage: p.transform(<transformation>) # haven't checked that but would be natural
```

By the way: the documentation of Plot3d.transform does not make it clear that one can pass in a matrix; and it needs to be passed as m=<matrix>... which is not great.

But I haven't checked on matplotlib, and being consistent with it would be nice too.

Cheers,

Nicolas

### comment:3 Changed 6 years ago by vbraun_spam

• Milestone changed from sage-6.3 to sage-6.4

### comment:4 Changed 4 years ago by slelievre

• Cc slelievre added
• Description modified (diff)

Adding examples of user requests to ticket description.

Note: See TracTickets for help on using tickets.