how to plot a circle (without circle())
Hello, I know you can plot a circle with circle(x,y,radius), but how do you do it with plot()?
There are several ways you can use plot
or similar functions.
use plot
with the circle as the graphics object you already discovered:
sage: plot(circle((0, 0), 2))
express y as a function of x for two half-circles (this will miss part of the circle):
sage: p = plot(sqrt(4 - x^2), (-3, 3))
sage: q = plot(-sqrt(4 - x^2), (-3, 3))
sage: (p + q).show(aspect_ratio=1)
use an implicit plot starting from an equation for the circle:
sage: x, y = SR.var("x y")
sage: implicit_plot(x^2 + y^2 - 4, (x, -3, 3), (y, -3, 3))
use a parametric plot for the circle; here is one (there are many others):
sage: t = var('t')
sage: parametric_plot((2*cos(t), 2*sin(t)), (t, 0, 2*pi))
In this case I would recommend the parametric plot rather than the functions or the implicit plot.
Asked: 2017-09-20 15:43:54 -0600
Seen: 826 times
Last updated: Sep 21 '17
Is it possible to embed a plot (or png) within another plot?
plot unions, intersections, etc.
Showing a Graphic3d object [closed]
How can I display a polytope in SageMathCloud?
In-line graphics for Sage in ipython notebook?
Display a graphics object with multiple primatives
Why does graph plotting crop so aggressively, and what is a work-around?