I'll cut to the chase and get right to the code!
import pandas as pd import numpy as np import as plt fig, ax = () bar_positions=[1,2,3,4] bar_heights=[1,2,3,4] print((len([2,2,3,4,5])+1)) ((len([2,2,3,4,5])),[1,2,3,4,5], 0.5)#Set x, y data, interval ax.set_xticks([1,2,3,4,5,6])# Setting the x-axis scale ax.set_xticklabels([1,2,3,4,5], rotation=45)#Set x-axis labels, rotate 45 degrees ax.set_yticks([1,2,3,4,5,6])# Setting the x-axis scale ax.set_yticklabels([1,2,3,4,5], rotation=45)# Set y-axis labels to rotate 45 degrees ax.set_ylim(0, 7)# Set the y-axis range ax.set_xlim(0, 7)# Set the x-axis range, as long as the axis data range doesn't conflict with the coordinate scale. ax.set_facecolor("orange")# Set the background color to red for a,b in zip(bar_positions,bar_heights):#Display data labels (a, b+0.05, '%.0f' % b, ha='center', va= 'bottom',fontsize=7) ('D:\\\python_practice\\\ exported image.png')#SavePicture () existmatplotlibGenerally used to set the window size。 (figsize=(10, 10)) However, if you use the,Then this method is ineffective.,passsubplotsSet your own window size。 fig, ax1 = (figsize=(10, 10))
The above example of this drawing and exporting and saving is all I have to share with you, I hope it will give you a reference, and I hope you will support me more.