Thanks! This corrects plotting the sine and cosine functions.
But there is no difference when plotting arrows, except the fuzzier
axes you mentioned.
Any ideas about that one?

I really prefer plotting to look as it should with fuzzier axes since
otherwise sage can not be used to present graphs for other people.

On 8 Nov., 19:37, Jason Grout <jason-s...@creativetrax.com> wrote:
> On 11/8/10 5:00 PM, Karsten wrote:
>
>
>
>
>
>
>
>
>
> > I am a beginner using sage, and I have encountered a problem using the
> > plot function. Plotting a simple sine or cosine function is not very
> > precise:
>
> > t=var('t')
> > v=plot(sin(t),-pi,pi
>
> > The function is clearly positive in t=-pi, where it should be zero.
> > The mistake becomes even more clear when setting line thickness to 99:
>
> > t=var('t')
> > v=plot(sin(t),-pi,pi,thickness=99)
>
> > In this case when x=0 the line is crossing 1 in the upper side and not
> > -1 in the lower side.
>
> > This problem occurs in all functions i have encountered so far, as if
> > the function is displayed 1 or 2 pixels off. It's even worse when
> > plotting arrows:
>
> > plot(arrow((0,0), (2,3)))
>
> > Here the arrow is clearly not starting in (0,0) as it should.
>
> > Is there a solution for this kind of problem?
>
> Yes.  It's a tradeoff between sharper graphics and rounding issues with
> pixels in plots.  IIRC, the basic issue is that horizontal and vertical
> lines are "snapped" to the nearest pixel, so that they aren't
> anti-aliased and fuzzy.
>
> This has been investigated quite a bit at:
>
> http://trac.sagemath.org/sage_trac/ticket/7808
>
> In short, you can do:
>
> import matplotlib
> matplotlib.rcParams['path.snap'] = False
>
> This will make horizontal and vertical lines (like the axes) not snap to
> the nearest pixel.  Things may be a bit fuzzier, though.
>
> Thanks,
>
> Jason

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to