❶ 用python matplotlib 怎么画风向玫瑰图 能给出程序的
importnumpyasnp
importmatplotlib.pyplotasplt
N=20
theta=np.linspace(0.0,2*np.pi,N,endpoint=False)
radii=10*np.random.rand(N)
width=np.pi/4*np.random.rand(N)
ax=plt.subplot(111,projection='polar')
bars=ax.bar(theta,radii,width=width,bottom=0.0)
#Usecustomcolorsandopacity
forr,barinzip(radii,bars):
bar.set_facecolor(plt.cm.jet(r/10.))
bar.set_alpha(0.5)
plt.show()

差不多上面代码的原理,具体的自己照着官方文档改
❷ python怎么画玫瑰花
操纵海龟绘图有着许多的命令,这些命令可以划分为两种:一种为运动命令,一种为画笔控制命令
1. 运动命令:
forward(degree) #向前移动距离degree代表距离
backward(degree) #向后移动距离degree代表距离
right(degree) #向右移动多少度
left(degree) #向左移动多少度
goto(x,y) #将画笔移动到坐标为x,y的位置
stamp() #复制当前图形
speed(speed) #画笔绘制的速度范围[0,10]整数
2. 画笔控制命令:
down() #移动时绘制图形,缺省时也为绘制
up() #移动时不绘制图形
pensize(width) #绘制图形时的宽度
color(colorstring) #绘制图形时的颜色
fillcolor(colorstring) #绘制图形的填充颜色
fill(Ture)
fill(false)
lucy : 梦想照进现实;露茜;青春风采;
draw_flower1.py
[python]view plain
#-*-coding:cp936-*-
importturtle
importmath
defp_line(t,n,length,angle):
"""Drawsnlinesegments."""
foriinrange(n):
t.fd(length)
t.lt(angle)
defpolygon(t,n,length):
"""Drawsapolygonwithnsides."""
angle=360/n
p_line(t,n,length,angle)
defarc(t,r,angle):
"""."""
arc_length=2*math.pi*r*abs(angle)/360
n=int(arc_length/4)+1
step_length=arc_length/n
step_angle=float(angle)/n
#Beforestartingreces,makingaslightleftturn.
t.lt(step_angle/2)
p_line(t,n,step_length,step_angle)
t.rt(step_angle/2)
defpetal(t,r,angle):
"""Drawsa花瓣usingtwoarcs."""
foriinrange(2):
arc(t,r,angle)
t.lt(180-angle)
defflower(t,n,r,angle,p):
"""Drawsaflowerwithnpetals."""
foriinrange(n):
petal(t,r,angle)
t.lt(p/n)
defleaf(t,r,angle,p):
"""Drawsa叶子andfillit."""
t.begin_fill()#Beginthefillprocess.
t.down()
flower(t,1,40,80,180)
t.end_fill()
defmain():
window=turtle.Screen()#creatascreen
window.bgcolor("blue")
lucy=turtle.Turtle()
lucy.shape("turtle")
lucy.color("red")
lucy.width(5)
lucy.speed(0)
#Drawingflower
flower(lucy,7,60,100,360)
#Drawingpedicel
lucy.color("brown")
lucy.rt(90)
lucy.fd(200)
#Drawingleaf
lucy.rt(270)
lucy.color("green")
leaf(lucy,40,80,180)
lucy.ht()
window.exitonclick()
main()
❸ 怎样用程序编写编写玫瑰花的代码,c程序或gava或者python
网上能搜到
❹ 用Python matplotlib 怎么画风向玫瑰图 能给出程序的
python安装(之前写过一篇关于python的安装,这里不重复介绍)
(1) 如何下载?网络---> Python官网
(2) 版本:python-3.4.3.amd64 exe文件直接点哦
(3) 目录:D:\Python34
为python配置了环境变量:D:\Python34\Scripts;D:\Python34
(4) 命令行输入:python 有反应表示成功
说明:matplotlib还没有匹配python3.5的版本,我的电脑为64位
0Python安装学习指南
软件包下载:
因为涉及到众多包的下载,以及其中的版本和电脑位数问题特介绍如下( 注意加粗的字体):
(1) numpy numpy-1.10.1+mkl-cp34-none-win_amd64.whl
(2) matplotlib matplotlib-1.4.3.win-amd64-py3.4b/matplotlib-1.4.3/windows/
(3) 依赖包:pyparsing、dateutil、scipy
声明:以上软件地址可自行网络搜索
附注:图一为matplotlib 、图二为numpy 下载界面的选择
软件包numpy的安装:
1 命令行输入【完整的路径=numpy 在你电脑的绝对路径】
pip install 完整的路径\numpy -1.10.1+mkl-cp34-none-win_amd64.
2 验证:python编辑下 python>>
from numpy import *
安装matplotlib:
matplotlib-1.4.3.win-amd64-py3.4
因为下载的是exe文件,点击一路执行即可
依赖包的安装:
在命令行里逐行输入如下命令:软件包的绝对路径
1 pip install 绝对路径\pyparsing-2.0.3-py3-none-any.whl
2 pip install 绝对路径\python_dateutil-2.4.2-py2.py3-none-any.whl
3 pip install 绝对路径\matplotlib依赖\scipy-0.16.0-cp34-none-win_amd64.whl
验证是否安装成功:
1 在python编辑状态下导入安装的包:
import matplotlib
import numpy
import scipy
import pyparsing
import matplotlib.pyplot as plt
2 如果缺少six
在安装完毕scipy之后把../Python34/Lib/site-packages/scipy/lib中的six.py six.pyc six.pyo三个文件拷贝到.../Python34/Lib/site-packages
案例1:
import matplotlib.pyplot as plt
x = [0, 1, 2, 3, 4, 5]
y = [0.1, 0.2, 0.2, 0.3, 0.2, 0.1]
y2 = [0.2, 0.2, 0.3, 0.2, 0.3, 0]
plt.plot(x, y, 'b', x, y2, 'g')
plt.show()
案例2:
import matplotlib.pyplot as plt
import math
x=[]
y=[]
num=0.0
while num < math.pi * 4:
y.append(math.sin(num))
x.append(num)
num += 0.1
plt.plot(x, y, 'b')
plt.show()
❺ 怎么用python画玫瑰花,求大神贴代码,感激不尽
importturtle
#设置初始位置
turtle.penup()
turtle.left(90)
turtle.fd(200)
turtle.pendown()
turtle.right(90)
#花蕊
turtle.fillcolor("red")
turtle.begin_fill()
turtle.circle(10,180)
turtle.circle(25,110)
turtle.left(50)
turtle.circle(60,45)
turtle.circle(20,170)
turtle.right(24)
turtle.fd(30)
turtle.left(10)
turtle.circle(30,110)
turtle.fd(20)
turtle.left(40)
turtle.circle(90,70)
turtle.circle(30,150)
turtle.right(30)
turtle.fd(15)
turtle.circle(80,90)
turtle.left(15)
turtle.fd(45)
turtle.right(165)
turtle.fd(20)
turtle.left(155)
turtle.circle(150,80)
turtle.left(50)
turtle.circle(150,90)
turtle.end_fill()
#花瓣1
turtle.left(150)
turtle.circle(-90,70)
turtle.left(20)
turtle.circle(75,105)
turtle.setheading(60)
turtle.circle(80,98)
turtle.circle(-90,40)
#花瓣2
turtle.left(180)
turtle.circle(90,40)
turtle.circle(-80,98)
turtle.setheading(-83)
#叶子1
turtle.fd(30)
turtle.left(90)
turtle.fd(25)
turtle.left(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(-80,90)
turtle.right(90)
turtle.circle(-80,90)
turtle.end_fill()
turtle.right(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)
#叶子2
turtle.right(90)
turtle.right(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(80,90)
turtle.left(90)
turtle.circle(80,90)
turtle.end_fill()
turtle.left(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(60)
turtle.right(90)
turtle.circle(200,60)
运行结果:

❻ 求问怎样用python/python turtle画“心”
python turtle画4个同心圆方法
importturtle
#drawfirstcircle
turtle.penup()
turtle.goto(0,-200)
turtle.pendown()
turtle.circle(200)
#drawsecondcircle
turtle.penup()
turtle.goto(0,-150)
turtle.pendown()
turtle.circle(150)
#drawthirdcircle
turtle.penup()
turtle.goto(0,-100)
turtle.pendown()
turtle.circle(100)
#drawfourthcircle
turtle.penup()
turtle.goto(0,-50)
turtle.pendown()
turtle.circle(50)
画笔的坐标默认在0,0,就以它为圆心。
因为turtle画圆的时候是从圆的底部开始画的,所以需要找到四个圆底部的坐标
比如:
第一个半径为200的圆,底部为(0,-200)
第二个半径为150的圆,底部为(0,-150)
第三个半径为100的圆,底部为(0,-100)
第四个半径为 50的圆,底部为(0, -50)
画的时候按下面的步骤:
抬起画笔:turtle.penup()
移动到相应坐标:turtle.goto(坐标)
放下画笔:turtle.pendown()
画圆:turtle.circle(半径)
效果如下图所示:

❼ 教我画玫瑰花或者在电脑上绘制出来!
直线条法。
用越来越多的线条来画玫瑰。从中心开始,线条是短的,第一根画完,第二根要跟第一根成一定角度,但不要交叉,第三根又跟第二根成角度。这样一直画下去,线条越来越长,花也越来越大,你想画多大画多大,这样又简单又好看
❽ python画爱心的代码怎么运行
首先一定是电脑安装python之上才能运行的,可以在电脑中找到代码储存位置,复制粘贴到查找位置,直接回车就会运行代码

❾ 如何画出简易玫瑰花
先画一个圆圈,然后在圆圈中画相互交错的直线,直线越画越短,最后出现一朵玫瑰花