Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rendering a plot changes its dimensions [was: graphics_array messes up dimensions of plots] #8019

Closed
pdehaye mannequin opened this issue Jan 21, 2010 · 6 comments
Closed

Comments

@pdehaye
Copy link
Mannequin

pdehaye mannequin commented Jan 21, 2010

The following code should illustrate this, see picture below, everything gets scaled for no reason.

graph = circle((0,0),20)
graph.set_aspect_ratio(1)
graph2 = graphics_array([[graph]*4]*4)
graph2.show()

The real reason is that axes_pad<>0 will affect the same picture every time it's rendered (to be saved or displayed), and change its dimensions by 2% each time by default. I can understand the need for axes_pad, but don't think this should happen:

graph = circle((0,0),20)
graph.show()
print graph.get_axes_range()
graph.save('test.png')
graph.save('test.png')
graph.save('test.png')
graph.save('test.png')
graph.save('test.png')
print graph.get_axes_range()
graph.show()

and compare with

graph = circle((0,0),20)
graph.show(axes_pad=0)
print graph.get_axes_range()
graph.save('test.png',axes_pad=0)
graph.save('test.png',axes_pad=0)
graph.save('test.png',axes_pad=0)
graph.save('test.png',axes_pad=0)
graph.save('test.png',axes_pad=0)
print graph.get_axes_range()
graph.show(axes_pad=0)

Component: graphics

Keywords: axes_range, axes_pad

Author: Paul Dehaye

Issue created by migration from https://trac.sagemath.org/ticket/8019

@pdehaye pdehaye mannequin added this to the sage-4.6.1 milestone Jan 21, 2010
@pdehaye pdehaye mannequin added c: graphics labels Jan 21, 2010
@pdehaye pdehaye mannequin assigned williamstein Jan 21, 2010
@pdehaye
Copy link
Mannequin Author

pdehaye mannequin commented Jan 21, 2010

comment:1

Attachment: circles.png

@pdehaye

This comment has been minimized.

@pdehaye
Copy link
Mannequin Author

pdehaye mannequin commented Jan 21, 2010

Changed keywords from graphics_array, scale to axes_range, axes_pad

@pdehaye

This comment has been minimized.

@pdehaye pdehaye mannequin added p: major / 3 and removed p: minor / 4 labels Jan 21, 2010
@pdehaye pdehaye mannequin changed the title graphics_array messes up dimensions of plots rendering a plot changes its dimensions [was: graphics_array messes up dimensions of plots] Jan 21, 2010
@jasongrout
Copy link
Member

comment:3

I think the problem is that in the save routine (actually, in the .matplotlib() method), the x and y limits are changed according to the axes_pad setting. Instead, they should be temporarily changed and then changed back so that the graphic has the same x and y limits as it did when starting.

@mwhansen
Copy link
Contributor

comment:4

This has been fixed by #10291.

@mwhansen mwhansen removed this from the sage-4.6.1 milestone Dec 21, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants