我從蜘蛛(anaconda)的實驗輸出中繪制了一些值。我想將 x 軸科學記數法從 1e-05 更改為 1e-06。我用谷歌搜索,找不到這個問題的相關解決方案。請幫忙
enter code here
#匯入庫
import numpy as np
import csv
import matplotlib.pyplot as plt
import pylab
import style
#Handling value error
def isfloat(num):
try:
float(num)
return True
except ValueError:
return False
#import csv file
with open( 'try1.csv', 'r') as i:
file01= list(csv.reader(i,delimiter=','))[2:]
file02=[[float(k) if (isfloat(k)) else 0 for k in j] for j in file01] # Picking the values only
#creating a mumpy array
Data= np.array(file02, dtype=float)
xdata= Data[:,0][::280]
ydata= Data[:,1][::280]
#Plot
plt.figure(1,dpi=800)
plt.title('Force Spectroscopy')
plt.ylabel('Vertical Deflection')
plt.xlabel('Measured Height')
plt.style.use(['seaborn_grid'])
plt.plot(xdata,ydata, color='green',label=('Experimental data'))
#Theoritical Plot
new= -(0.107e-5)*xdata
plt.plot(xdata,new, color= 'purple',label='Theoritical')
#Legend Modification
plt.legend('upper right',fontsize=20)
plt.legend()

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/495133.html
標籤:Python matplotlib
