From: Jochen V. <vo...@se...> - 2004-11-04 12:05:31
|
Hello, I am still trying to understand how to fix the aspect ration of figures generated with matplotlib. I made some progress but still have questions. In my script (appended to this mail) I do the following: 1) First I set up a figure as f=figure(figsize=(3,2),frameon=False) ax=axes() ax.update_datalim(((-0.5,-0.5),(2.5,1.5))) ax.autoscale_view () My plan is that the lower left corner of the figure corresponds to (-0.5, -0.5) and the upper corner of the figure corresponds to (2.5,1.5) now. The x- and y-coordinate ranges have ratio 3:2 and the figure width and height also have ratio 3:2. Thus I expect the aspect ratio to be 1. Questions: Is the combination of update_datalim and autoscale_view a good way to do this? Is there a more direct way to prescribe the coordinate range of the figure? 2) I try to draw some squares using commands like p = Rectangle((0.1, 0.1), 0.8, 0.8, fill=True, fc=(1,0,0)) ax.add_patch(p) The resulting rectangle looks almost square, but inspecting the PostScript file reveals that it has width 44.64 and height 45.502 PostScript units. This seems to much to be caused by rounding errors. Question: why is the rectangle not square? 3) The pattern of squares I draw is centered in the coordinate range. The resulting picture is not centered in the image window (and neither in the PostScript bounding box). Question: why is the picture not centred? All the best and many thanks in advance, Jochen -- http://seehuhn.de/ |