How Python Draws a circle

Source: Internet
Author: User
Tags in degrees

http://blog.csdn.net/pipisorry/article/details/40005163

1. Call the package function to draw the circle circle and Ellipse ellipse

####################################   !/usr/bin/env python#   coding=utf-8#   __author__ = ' pipi ' #   CTime 2014.10.11#   draw Oval and round ################################## #from matplotlib.patches import Ellipse,  Circleimport Matplotlib.pyplot as Pltfig = plt.figure () ax = Fig.add_subplot (111) ell1 = Ellipse (xy = (0.0, 0.0), width = 4, Height = 8, angle = 30.0, facecolor= ' yellow ', alpha=0.3) Cir1 = Circle (xy = (0.0, 0.0), radius=2, alpha=0.5) Ax.add_patch ( ELL1) Ax.add_patch (cir1) x, y = 0, 0ax.plot (x, y, ' ro ') plt.axis (' scaled ') # Ax.set_xlim ( -4, 4) # Ax.set_ylim ( -4, 4) Plt.axis ( ' Equal ')   #changes limits of x or Y axis so, equal increments of x and Y have the same lengthplt.show ()
See matplotlib.pdf Release 1.3.1 Documentation

p187

18.7 ellipses (see ARC)


p631
Class Matplotlib.patches. Ellipse (xy, width, height, angle=0.0, **kwargs)
Bases:matplotlib.patches.Patch
A scale-free ellipse.
XY Center of Ellipse
Width total length (diameter) of horizontal axis
Height total length (diameter) of vertical axis
Angle rotation in degrees (anti-clockwise)

p626
Class Matplotlib.patches. Circle (XY, radius=5, **kwargs)


or see matplotlib.pdf Release 1.3.1 Document Contour Draw a circle

#coding =utf-8import NumPy as Npimport matplotlib.pyplot as Pltx = y = Np.arange ( -4, 4, 0.1) x, y = Np.meshgrid (x, y) plt.cont Our (x, y, x**2 + y**2, [9])     #x **2 + y**2 = 9 round plt.axis (' scaled ') plt.show ()
p478
Axes3d. Contour(X, Y, Z, *args, **kwargs)
Create a 3D contour plot.
Argument Description
X, Y, Data values as Numpy.arrays
Z
Extend3d
Stride
Zdir
Offset
Whether to extend contour in 3D (default:false)
Stride (step size) for extending contour
The direction to use:x, Y or Z (default)
If specified plot a projection of the contour lines on this position in plane normal to Zdir
The positional and other


p1025

Matplotlib.pyplot. Axis (*v, **kwargs)
Convenience method to get or set axis properties.



or see Demo

"Pylab_examples Example code:ellipse_demo.py"



2. Direct drawing



from:http://blog.csdn.net/pipisorry/article/details/40005163

ref:http://www.zhihu.com/question/25273956/answer/30466961?group_id=897309766#comment-61590570



How Python Draws a circle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.