2017-06-06 73 views
0

我寫了下面的代碼:Python的繪圖問題

full_list = [0, 10**3, 10**6, 10**9, 10**12, 10**15] 

list1 = [] 
list2 = [] 
list3 = [] 

for hash_power in full_list: 
    x1 = Calc1() 
    list1.append(x1) 

    x2 = Calc2() 
    list2.append(x2) 

    x3 = Calc3() 
    list3.append(x3) 

fig = plt.figure() 
ax = fig.add_subplot(111) 
ax.plot(full_list,list1,'r-->',full_list,list2,'g--o',full_list,list3,'b--o') 
plt.show() 

當產生的身影,在x軸上的分佈只產生第一個和最後一個點,從中間的full_list忽略所有的點。

我知道範圍真的很大,但有沒有辦法顯示它?

+0

你爲'plt'使用了什麼庫? – gmoshkin

+0

import matplotlib.pyplot as plt – user123

+0

Calc1/2/3的輸出是什麼? – TLOwater

回答

1

如果您有大數值填充您的座標軸 - 您可能需要考慮重新調整數字座標軸,使它們成爲對數座標而不是線性座標。在this stackoverflow thread中可找到如何做到這一點的步驟。

或者甚至更簡單地,以非對數增量定製您的數字座標軸上的比例,發現它是in this thread

+0

是這樣工作 N = len(full_list) n = np.arange(N) 然後我用n代替了每個full_list – user123