numpy np matplotlib.pyplot plt plt.rcParams[] = [] plt.rcParams[] = countries = [] cat_percent = [] dog_percent = [] countries = np.array(countries) cat_data = np.array(cat_percent) dog_data = np.array(dog_percent) fig(ax1ax2) = plt.subplots(=()) bar_height = y_index = np.arange((countries)) ax1.barh(y_indexcat_data=bar_height=) ax1.set_title(=) ax1.set_xlabel(=) ax1.set_yticks(y_index) ax1.set_yticklabels(countries=) ax1.invert_yaxis() ax1.grid(===) ax2.barh(y_indexdog_data=bar_height=) ax2.set_title(=) ax2.set_xlabel(=) ax2.set_yticks(y_index) ax2.set_yticklabels(countries=) ax2.invert_yaxis() ax2.grid(===) plt.tight_layout() plt.subplots_adjust(=) plt.show()
python
hym
未分类
评论0次
2025-04-09
2025-04-09
20
发表评论
