Opened 6 years ago

Last modified 4 years ago

#16484 new enhancement

Transformations for 2D plots

Reported by: nthiery Owned by:
Priority: major Milestone: sage-6.4
Component: graphics Keywords:
Cc: slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by slelievre)

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

Requested on

Change History (4)

comment:1 follow-up: 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

Replying to 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.

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.

http://matplotlib.org/users/transforms_tutorial.html

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.