

bar ( ) ) ] ,df_wa ,width = 0.3, color =b1 ,label = "Agricultural" ) subplot ( 1, 2, 2 ) #plt.grid(visible=True,axis="y",linestyle = "-") # Set the background grid line to dashed line ylabel ( "WATER CONSUMPTION (Mgal/d)" ,fontsize = 13 ,fontweight = 'bold' ) xlabel ( "STATE" ,fontsize = 13 ,fontweight = 'bold' ) yticks (, ,size = 13 ,fontweight = 'bold' ) xticks ( ) ) ] ,df_wa ,size = 13 ,fontweight = 'bold' ) bar ( ) ) ] ,df_wa, width = 0.1 ,color = 'red' ,label = "Thermoelectric" ) bar ( ) ) ] ,df_wa, width = 0.1 ,color = 'brown' ,label = "Mining" ) bar ( ) ) ] ,df_wa, width = 0.1 ,color = 'purple' ,label = "Livestock" ) bar ( ) ) ] ,df_wa, width = 0.1 ,color = 'deeppink' ,label = "Industrial" ) bar ( ) ) ] ,df_wa, width = 0.1 ,color = 'dodgerblue' ,label = "Aquaculture" ) bar ( ) ) ] ,df_wa ,width = 0.1 ,color = 'orange' ,label = "Public Supply" ) bar ( ) ) ] ,df_wa, width = 0.1 ,color = 'green' ,label = "Irrigation" )

tick_params (axis = u'both', which = u'both' ,length = 0 ) # Remove the scale line set_visible ( False ) # Remove the right borderĪx. subplot ( 1, 2, 1 ) #plt.grid(visible=True,axis="y",linestyle = "-") # Set the background grid line to dashed lineĪx. png ',format='png' )Ĭombination chart plt. tight_layout ( ) # plt.xlim(3,21) # Set up x The scope of the shaft # plt.ylim(0.5,1) ylabel ( "Electricity price" ,fontsize = 13 ,fontweight = 'bold' )

xlabel ( "Year" ,fontsize = 13 ,fontweight = 'bold' ) setp (ltext, fontsize = 12 ,fontweight = 'bold' ) # Set the size and thickness of the legend font yticks (fontsize = 12 ,fontweight = 'bold' ) xticks (fontsize = 12 ,fontweight = 'bold' ) # The default font size is 10 legend ( ) # Displays the legend of each curve plot (df_ep ,df_ep ,label = 'Wyoming' ,linewidth = 2 ,color =color5 ) plot (df_ep ,df_ep ,label = 'New Mexico' ,linewidth = 2 ,color =color4 ) plot (df_ep ,df_ep ,label = 'Colorado' ,linewidth = 2 ,color =color3 ) plot (df_ep ,df_ep ,label = 'California' ,linewidth = 2 ,color =color2 ) plot (df_ep ,df_ep ,label = 'Arizona' ,linewidth = 2 ,color =color1 ) set_visible ( False ) # Remove the right border # ax.tick_params(axis=u'both', which=u'both',length=0) # Remove the scale line set_visible ( False ) # Remove the top borderĪx. figure (figsize = ( 10, 5 ) ) #plt.grid(linestyle = "-") # Set the background grid line to dashed lineĪx. If you want to draw a picture, you can configure multiple basic settings, Here I can provide my settings : Monograph # Mapping census data 2000-2020 year # Arizona、California、Colorado、New Mexico、Wyoming rcParams = False # Show minus sign import pandas as pdī1 ,color1 ,color2 ,color3 ,color4 ,color5 = '#636efa', '#c8141c', 'dodgerblue', '#8714d0', 'green', 'orangered' Block diagram settings rcParams = 500 # The resolution of the # Arial Helvetica TIMES NEW ROMAN # If you want to display Chinese font, Set here as :SimHei

Then I chose some colors that I thought were good-looking. ( Here I did a test to enlarge it dpi When the value of ,svg The size of the image file has not changed. What I want to say here is that the drawing is derived from png、jpg If the image file is composed of a pixel and resolution that can be changed, it should be slightly larger, But if you use that svg Format picture words, Image pixels will not change significantly. Python Although there are many visual packages, But I think matplotlib The functions are quite comprehensive. This template is based on 2022 The template sorted out by the drawing experience during the American Games in.
