Opened 13 years ago

Closed 12 years ago

#8019 closed defect (invalid)

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

Reported by: pdehaye Owned by: was
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: graphics Keywords: axes_range, axes_pad
Cc: Merged in:
Authors: Paul Dehaye Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by pdehaye)

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)

Attachments (1)

circles.png (50.6 KB) - added by pdehaye 13 years ago.

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by pdehaye

Attachment: circles.png added

comment:1 Changed 13 years ago by pdehaye

Description: modified (diff)

comment:2 Changed 13 years ago by pdehaye

Description: modified (diff)
Keywords: axes_range axes_pad added; graphics_array scale removed
Priority: minormajor
Summary: graphics_array messes up dimensions of plotsrendering a plot changes its dimensions [was: graphics_array messes up dimensions of plots]

comment:3 Changed 12 years ago by jason

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.

comment:4 Changed 12 years ago by mhansen

Milestone: sage-4.6.1sage-duplicate/invalid/wontfix
Resolution: invalid
Status: newclosed

This has been fixed by #10291.

Note: See TracTickets for help on using tickets.