#!/usr/bin/python
# -*- coding: UTF-8 -*-
import numpy as np
import matplotlib.pyplot as plt
x = y = np.arange(-11, 11, 0.1)
x, y = np.meshgrid(x,y)
#圆心为(0,0),半径为1-10
for i in range(1,11):
plt.contour(x, y, x**2 + y**2, [i**2])
#如果删除下句,得出的图形为椭圆
plt.axis('scaled')
plt.show()
import math as m
import matplotlib.pyplot as plt
x=[]
y=[]
for a in range(1,11):
for b in range(0,360):
x.append(a*(m.cos(m.pi*(b/180))))
y.append(a*(m.sin(m.pi*(b/180))))
plt.scatter(x,y,s=30)
plt.axis([-11,11,-11,11])
#避免因比例而压缩为椭圆
plt.axis('equal')
plt.show()
');
var statusdiv=$('#comment-status');
commentform.submit(function(e){
e.preventDefault();
var noteContent = editor.getValue();
// console.log(noteContent);
noteContent = noteContent.replace(/
/g,"
");
noteContent = noteContent.replace(//g,"
");
// 系列化表单数据
var comment_parent = 0;
var is_user_logged_in = $("#is_user_logged_in").val();
var comment_post_ID = 14234;
var _wp_unfiltered_html_comment = $("#_wp_unfiltered_html_comment").val();
var comment = noteContent;
var author = $("#author").val();
var url = $("#url").val();
var email = $("#email").val();
if(isBlank(author) && is_user_logged_in==0) {
statusdiv.html('
丸子酱
105***[email protected]
使用 turtle 模块 :
#usr/bin/env python #coding:utf-8 if __name__ == '__main__': import turtle turtle.title("画圆") turtle.setup(800,600,0,0) pen=turtle.Turtle() pen.color("yellow") pen.width(5) pen.shape("turtle") pen.speed(1) pen.circle(100)丸子酱
105***[email protected]
ngdy
374***[email protected]
画出10个半径依次增加定长的同心圆:
#!/usr/bin/python # -*- coding: UTF-8 -*- import numpy as np import matplotlib.pyplot as plt x = y = np.arange(-11, 11, 0.1) x, y = np.meshgrid(x,y) #圆心为(0,0),半径为1-10 for i in range(1,11): plt.contour(x, y, x**2 + y**2, [i**2]) #如果删除下句,得出的图形为椭圆 plt.axis('scaled') plt.show()ngdy
374***[email protected]
ngdy
374***[email protected]
import math as m import matplotlib.pyplot as plt x=[] y=[] for a in range(1,11): for b in range(0,360): x.append(a*(m.cos(m.pi*(b/180)))) y.append(a*(m.sin(m.pi*(b/180)))) plt.scatter(x,y,s=30) plt.axis([-11,11,-11,11]) #避免因比例而压缩为椭圆 plt.axis('equal') plt.show()ngdy
374***[email protected]