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
效果如下