Visual computing is an important part of data analysis, especially the module matplotlib.
Recently a new generation of plotting module plotly has come out of nowhere and has a definite advantage in terms of interactivity. However, it is still easier to plot some simple images using matplotlib.
In 2017 matplotlib 2.0 was released, offering six plotting styles for users to choose from.
'bmh','dark_background','fivethirtyeight','ggplot','grayscale','default'
Different integrated environments can increase the number of matplotlib plotting styles to over 20. These methods can be applied directly to pandas' plotting statements.
The image is plotted using the pandas data analysis module's built-in plot command, with the following code.
#coding=utf-8
'''
Created on 2020.09.29
'''
import matplotlib.pyplot as plt
import pandas as pd
def dr_xtyp(_dat):
#xtyp=['bmh','dark_background','fivethirtyeight','ggplot','grayscale','default']
for xss in plt.style.available:
plt.style.use(xss);print(xss)
_dat['Open'].plot()
_dat['Close'].plot()
_dat['High'].plot()
_dat['Low'].plot()
fss="tmp\\stk001_"+xss+"_pd.png";plt.savefig(fss)
plt.show()
# =======================
df = pd.read_csv('dat\\appl2014.csv',index_col=0,parse_dates=[0],encoding='gbk')
d30=df[:30]
dr_xtyp(d30)
Results of the run.
A variety of different styles of images will be produced in the tmp directory.