Python batch drawing of subgraphs + adding main title + solving Chinese garbled code

totobey 2022-06-23 18:38:50 阅读数:65

pythonbatchdrawingsubgraphsadding

import numpy as np
import pandas as pd
import time # It is used to count the running time
import copy # Use for deep copy
import _pickle as cPickle
import gc # Free up memory usage
from tqdm import tqdm,tqdm_notebook #Tqdm It's a fast one , Extensible Python Progress bar
import datetime # Processing time data
import os
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator, FormatStrFormatter
plt.rcParams['font.sans-serif']=['SimHei'] # Used to display Chinese labels normally
plt.rcParams['axes.unicode_minus']=False # Used to display negative sign normally
import seaborn as sns
%matplotlib inline
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
warnings.filterwarnings("ignore")
pd.set_option('display.max_columns',100)
pd.set_option('max_colwidth',100)
baseline_cols=['verbal_memory_baseline','visual_memory_baseline','visual-motor_speed_baseline'
,'reaction_time_baseline','impulse_control_baseline','total_symptom_baseline']
# Draw a histogram
fig = plt.figure(figsize=(15, 6))
sns.set_style("darkgrid", {'font.sans-serif': ['simhei','FangSong']}) #s Set up style
# sns.set_style('whitegrid', {'font.sans-serif': ['simhei','FangSong']})
plt.suptitle('control group Of baseline Indicator histogram ',fontsize=20) # Set the main title
for i,col in enumerate(baseline_cols):
plt.subplot(2, 3, i + 1)
plt.hist(control[col])
plt.xlabel(col,fontsize=12)
plt.tight_layout()

 

版权声明:本文为[totobey]所创,转载请带上原文链接,感谢。 https://pythonmana.com/2022/174/202206231747477093.html