介紹一款新的繪圖神器:sviewgui。
此 GUI 是基於 matplotlib,您可以透過多種方式視覺化您的 csv 檔案。主要特點:
專案位址:https://github.com/SojiroFukuda/sview-gui
# 第一种形式 import sviewgui.sview as sv sv.buildGUI() # 第二种形式 import sviewgui.sview as sv FILE_PATH = "User/Documents/yourdata.csv" sv.buildGUI(FILE_PATH) # 第三种形式 import sviewgui.sview as sv import pandas as pd FILE_PATH = "User/Documents/yourdata.csv" df = pd.read_csv(FILE_PATH) sv.buildGUI(df)上面程式碼,只是幫助驅動開啟這個GuI視覺化介面。
pip install sviewgui -i https://pypi.tuna.tsinghua.edu.cn/simple/ --ignore-installed後面這個--ignore-installed,我最開始是沒加的,但是報錯了,大致錯誤如下:
ERROR: Cannot uninstall 'certifi'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.直到加這個就行,不用管為什麼,因為我也不知道!
import sviewgui.sview as sv sv.buildGUI()截圖如下:
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import cmocean #2021/07/13 08:03:18 #- Import CSV as DataFrame ---------- FILE_PATH = 'C:/Users/Administrator/Desktop/plot.csv' DATA = pd.read_csv(FILE_PATH) #- Axes Setting ---------- fig, ax = plt.subplots() ax.set_title( "x-y") ax.set_xlabel( "x") ax.set_ylabel( "x" ) ax.set_xlim(min(DATA['x'].replace([np.inf, -np.inf], np.nan ).dropna() ) - abs( min(DATA['x'].replace([np.inf, -np.inf], np.nan ).dropna() )/10), max(DATA['x'].replace([np.inf, -np.inf], np.nan).dropna()) + abs(max(DATA['x'].replace([np.inf, -np.inf], np.nan).dropna())/10)) ax.set_ylim( min(DATA['x'].replace([np.inf, -np.inf], np.nan ).dropna() ) - abs( min(DATA['x'].replace([np.inf, -np.inf], np.nan ).dropna() )/10), max(DATA['x'].replace([np.inf, -np.inf], np.nan).dropna()) + abs(max(DATA['x'].replace([np.inf, -np.inf], np.nan).dropna())/10)) #- PLOT ------------------ ax.plot( DATA["x"].replace([np.inf, -np.inf], np.nan), DATA["x"].replace([np.inf, -np.inf], np.nan), linewidth = 3.0, alpha =1.0, color = "#005AFF" ) plt.show()
以上是讚!推薦 Python 神器,不寫一行程式碼,就可以呼叫 Matplotlib 繪圖!的詳細內容。更多資訊請關注PHP中文網其他相關文章!