ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 06 Aug 2015 23:45:23 -0500polygon plot does not scale wellhttp://ask.sagemath.org/question/28763/polygon-plot-does-not-scale-well/Hi,
I'm trying to plot several polygons in one plot (with plot1+plot2+...). Strangly, for very different side length, the plot becomes more of a line instead of a rectangle. I tried the following code on SMC and locally:
hp=0.019
qscale=hp
polygon2d([[0.5-0.5,hp/2-qscale*0.05],[0.5+0.5,hp/2-qscale*0.05],[0.5+0.5,hp/2+qscale*0.05],[0.5-0.5,hp/2+qscale*0.05]], fill=False, thickness=1, color='blue',ticks=[None,0.0001])
I'd like to upload a picture but you need 60 karma points for that and since my old account belonging to google identity is lost I hope you can recreate the problem. Thanks in advance.
Update:
I wrote a minimal example which shows that the problem appears when the side length are not of the same order of magnitude
for i in [0.1,1,10,100]:
show(polygon2d([[0,0],[0,i],[1,i],[1,0]], fill=false))Thu, 06 Aug 2015 02:36:20 -0500http://ask.sagemath.org/question/28763/polygon-plot-does-not-scale-well/Answer by tmonteil for <p>Hi,</p>
<p>I'm trying to plot several polygons in one plot (with plot1+plot2+...). Strangly, for very different side length, the plot becomes more of a line instead of a rectangle. I tried the following code on SMC and locally:</p>
<pre><code>hp=0.019
qscale=hp
polygon2d([[0.5-0.5,hp/2-qscale*0.05],[0.5+0.5,hp/2-qscale*0.05],[0.5+0.5,hp/2+qscale*0.05],[0.5-0.5,hp/2+qscale*0.05]], fill=False, thickness=1, color='blue',ticks=[None,0.0001])
</code></pre>
<p>I'd like to upload a picture but you need 60 karma points for that and since my old account belonging to google identity is lost I hope you can recreate the problem. Thanks in advance.</p>
<p>Update:</p>
<p>I wrote a minimal example which shows that the problem appears when the side length are not of the same order of magnitude</p>
<pre><code>for i in [0.1,1,10,100]:
show(polygon2d([[0,0],[0,i],[1,i],[1,0]], fill=false))
</code></pre>
http://ask.sagemath.org/question/28763/polygon-plot-does-not-scale-well/?answer=28764#post-id-28764To specify the ratio between the axes, you can use the `aspect_ratio` option.
In your first example:
sage: polygon2d([[0.5-0.5,hp/2-qscale*0.05],[0.5+0.5,hp/2-qscale*0.05],[0.5+0.5,hp/2+qscale*0.05],[0.5-0.5,hp/2+qscale*0.05]], fill=False, thickness=1, color='blue',ticks=[None,0.0001], aspect_ratio=500)
In your second example:
sage: for i in [0.1,1,10,100]:
....: show(polygon2d([[0,0],[0,i],[1,i],[1,0]], fill=false), aspect_ratio=1/i)
Thu, 06 Aug 2015 11:41:56 -0500http://ask.sagemath.org/question/28763/polygon-plot-does-not-scale-well/?answer=28764#post-id-28764Comment by kafussl for <p>To specify the ratio between the axes, you can use the <code>aspect_ratio</code> option.</p>
<p>In your first example:</p>
<pre><code>sage: polygon2d([[0.5-0.5,hp/2-qscale*0.05],[0.5+0.5,hp/2-qscale*0.05],[0.5+0.5,hp/2+qscale*0.05],[0.5-0.5,hp/2+qscale*0.05]], fill=False, thickness=1, color='blue',ticks=[None,0.0001], aspect_ratio=500)
</code></pre>
<p>In your second example:</p>
<pre><code>sage: for i in [0.1,1,10,100]:
....: show(polygon2d([[0,0],[0,i],[1,i],[1,0]], fill=false), aspect_ratio=1/i)
</code></pre>
http://ask.sagemath.org/question/28763/polygon-plot-does-not-scale-well/?comment=28766#post-id-28766Works like a charm. Thank you.Thu, 06 Aug 2015 23:45:23 -0500http://ask.sagemath.org/question/28763/polygon-plot-does-not-scale-well/?comment=28766#post-id-28766