1. 如何采用python语言绘制一个五角星
#!/usr/bin/env python
import turtle
import time
turtle.forward(100)
turtle.right(144)
time.sleep(1)
turtle.forward(100)
turtle.right(144)
time.sleep(1)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
time.sleep(1)
turtle.right(144)
turtle.forward(100)
time.sleep(3)
2. 在Flash中如果要绘制天上的白云,可采用什么方法
1、背景设为天蓝色。也可以用图层1绘制蓝天。
2、新建图层,绘制白云:用椭圆工具,取消边线,填充色60%白色,画出一些部分重叠的椭圆,像云朵就行。然后框选白云,转换成电影剪辑。再用滤镜进行模糊和加阴影。然后可用补间动画做白云的飘动。
3. 已知股票数据,如何用Python绘制k线日对应数据
我没遇到过 只是自己写过
有点经验
先确定时间片
然后再把tick插入就行了
4. python matplotlib模块 如何画两张图出来
python matplotlib模块 如何画两张图出来的方法:
代码如下所示:
import numpy as np
import matplotlib.pyplot as plt
#创建自变量数组
x= np.linspace(0,2*np.pi,500)
#创建函数值数组
y1 = np.sin(x)
y2 = np.cos(x)
y3 = np.sin(x*x)
#创建图形
plt.figure(1)
'''
意思是在一个2行2列共4个子图的图中,定位第1个图来进行操作(画图)。
最后面那个1表示第1个子图。那个数字的变化来定位不同的子图
'''
#第一行第一列图形
ax1 = plt.subplot(2,2,1)
#第一行第二列图形
ax2 = plt.subplot(2,2,2)
#第二行
ax3 = plt.subplot(2,1,2)
#选择ax1
plt.sca(ax1)
#绘制红色曲线
plt.plot(x,y1,color='red')
#限制y坐标轴范围
plt.ylim(-1.2,1.2)
#选择ax2
plt.sca(ax2)
#绘制蓝色曲线
plt.plot(x,y2,'b--')
plt.ylim(-1.2,1.2)
#选择ax3
plt.sca(ax3)
plt.plot(x,y3,'g--')
plt.ylim(-1.2,1.2)
plt.show()
附上效果图。
5. 怎么用python的turtle库画出这个图案,要代码
import turtle as t
def quad(color):
t.begin_fill()
t.color(color)
t.forward(100)
t.left(36)
t.forward(100)
t.left(36*4)
t.forward(100)
t.left(36)
t.forward(100)
t.end_fill()
t.left(36*3)
for i in range(10):
if i%2:
quad('#99c8de')
else:
quad('#e5b9c4')
两三年没碰海龟了,觉得没啥用,看你赏金又提了就回去学了学
6. python无边正方形绘制代码
你好,答案如下所示。
运行结果如图所示
希望你能够详细查看。
如果你有不会的,你可以提问
我有时间就会帮你解答。
希望你好好学习。
每一天都过得充实。
7. python中turtle如何画正五边形代码
import turtle as t
for i in range(5):
t.fd(100) #这里为正五边形边长
t.rt(72)
8. python绘制函数图像
raw_input获取的输入是字符串,不能直接用np.array,需要用split进行切分,然后强制转化成数值类型,才能用plot函数
我把你的代码稍微修改了一下,可能不太漂亮,不过能运行了
x=[1,2,3]
a = raw_input('function>>>')
a = a.split(' ')#依空格对字符串a进行切分,如果是用逗号分隔,则改成a.split(',')
b = []
for i in range(len(a)):#把切分好的字符强制转化成int类型,如果是小数,将int改为float
b.append(int(a[i]))
plt.plot(x, b, label='x', color="green", linewidth=1)
9. 如何用python绘制各种图形
1.环境
系统:windows10
python版本:python3.6.1
使用的库:matplotlib,numpy
2.numpy库产生随机数几种方法
import numpy as np
numpy.random
rand(d0,d1,...,dn)
In [2]: x=np.random.rand(2,5)
In [3]: x
Out[3]:
array([[ 0.84286554, 0.50007593, 0.66500549, 0.97387807, 0.03993009],
[ 0.46391661, 0.50717355, 0.21527461, 0.92692517, 0.2567891 ]])
randn(d0,d1,...,dn)查询结果为标准正态分布
In [4]: x=np.random.randn(2,5)
In [5]: x
Out[5]:
array([[-0.77195196, 0.26651203, -0.35045793, -0.0210377 , 0.89749635],
[-0.20229338, 1.44852833, -0.10858996, -1.65034606, -0.39793635]])
randint(low,high,size)
生成low到high之间(半开区间 [low, high)),size个数据
In [6]: x=np.random.randint(1,8,4)
In [7]: x
Out[7]: array([4, 4, 2, 7])
random_integers(low,high,size)
生成low到high之间(闭区间 [low, high)),size个数据
In [10]: x=np.random.random_integers(2,10,5)
In [11]: x
Out[11]: array([7, 4, 5, 4, 2])
3.散点图
x x轴
y y轴
s 圆点面积
c 颜色
marker 圆点形状
alpha 圆点透明度#其他图也类似这种配置
N=50# height=np.random.randint(150,180,20)# weight=np.random.randint(80,150,20)
x=np.random.randn(N)
y=np.random.randn(N)
plt.scatter(x,y,s=50,c='r',marker='o',alpha=0.5)
plt.show()
8.箱型图
import matplotlib.pyplot as pltimport numpy as npdata=np.random.normal(loc=0,scale=1,size=1000)#sym 点的形状,whis虚线的长度plt.boxplot(data,sym="o",whis=1.5)plt.show()
#sym 点的形状,whis虚线的长度
10. python 如何绘制下面这种图形
matplotlib可以画,这是帮助链接
matplotlib Stem Plot
效果如下