Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I determine or control a plot's display scale?

Suppose I do something like

p = plot(sin(x), (x,0,2*pi))
p.save("/tmp/plot.png")

Is there some way of knowing (or even better, controlling) exactly the scale of the saved image in pixels per axis unit (in each direction)?

For example, if I wish to write a second graph to a different png file at exactly the same scale, is there some way to do this?

Or, to put it differently, instead of specifying the size of the output png file in inches using figsize, I wish to specify the size in inches (or pixels) per graph unit.

This matplotlib tutorial seems to be about what interests me, but I don't understand how Sage relates to matplotlib, and how I can access the transData field, let alone control its value.