1.隐藏全部轴脊
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpathes
polygon = mpathes.RegularPolygon((0.5,0.5),6,0.2,color='g')
ax = plt.axes((0.3,0.3,0.5,0.5))
ax.add_patch(polygon)
ax.axis('off')
plt.title(2020080603035)
plt.show()
2.1.隐藏部分轴脊
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpathes
xy = np.array([0.5,0.5])
polygon = mpathes.RegularPolygon(xy,5,0.2,color='y')
ax = plt.axes((0.3,0.3,0.5,0.5))
ax.add_patch(polygon)
ax.spines['top'].set_color('none')
ax.spines['left'].set_color('none')
ax.spines['right'].set_color('none')
plt.title(2020080603035)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpathes
xy = np.array([0.5,0.5])
polygon = mpathes.RegularPolygon(xy,5,0.2,color='y')
ax = plt.axes((0.3,0.3,0.5,0.5))
ax.add_patch(polygon)
ax.spines['top'].set_color('none')
ax.spines['left'].set_color('none')
ax.spines['right'].set_color('none')
ax.yaxis.set_ticks_position('none')
ax.set_yticklabels([])
plt.title(2020080603035)
plt.show()
实例:
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter, HourLocator
plt.rcParams["font.sans-serif"] = ["SimHei"]
plt.rcParams["axes.unicode_minus"] = False
dates = ['201910240','2019102402','2019102404','2019102406',
'2019102408','2019102410','2019102412'