Python cómo dibujar un diagrama de caja coaxialmente con otros gráficos
importar matplotlib.pyplot como plt
importar numpy como np
desde scipy import interpolate
# fig, .axes = plt.subplots(1, 2, figsize=(8, 4))
fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, sharex= Verdadero, figsize=(6, 4))
#fig, .subplots(nrows=1, ncols=2, sharex=True, figsize=(6, 3))
n_wrms_before_filtering=[]
e_wrms_before_filtering=[]
u_wrms_before_filtering=[]
n_wrms_after_filtering=[]
e_wrms _after_filtering=[]
u_wrms_after_filtering=[]
lines = open("D. SoftwareInstallation")\softwareInstallation\SoftwareFile\Pycharm\PycharmProjects\boxplot\data\ wrms_neu1.dat", 'r'). readlines()
for i in range(len(lines)):
# datos divididos
campos = líneas[i].split(' ')
n_wrms_before_filtering.append(float(campos[0]))
e_wrms_before_filtering.append(float(campos[1]))
u_wrms_before_filtering.append(float (campos[2]))
lines = open("D:\SoftwareInstall\SoftwareFile\Pycharm\PycharmProjects\\boxplot\data\wrms_neu2.dat", 'r'). p>
for i in range(len(lines)):
# datos divididos
campos = líneas[i].split(' ')
n_wrms_after_filtering.append(float(campos[0]))
e_wrms_after_filtering.append(float(campos[1]))
u_wrms_after_filtering.append(float(campos[2] ))
etiquetas = 'N', 'E', 'U' #leyenda
p1=ax1.boxplot([n_wrms_befor
e_filtering, e_wrms_before_filtering, u_wrms_before_filtering], anchos = 0.set(facecolor=c)
#Establezca aquí otros atributos de cada cuadro
para bigote en p1['bigotes']:
whisker.set(color='#180405', linewidth=1.5)
para tapa en p1['caps']:
cap set(color. ='#180405', ancho de línea=1.5)
para mediana en p1['medians']:
median.set(color='#180405', ancho de línea= 1.5)
para el volante en p1['fliers']:
flier.set(marker='o', color='y', alpha=0.5)
etiquetas = 'N', 'E', 'U' #Labels
p2=ax2.boxplot([n_wrms_after_filtering, e_wrms_after_filtering, u_wrms_after_filtering], anchos = 0.set(color='#180405 ', ancho de línea =1.5)
para mediana en p2['medians']:
median.set(color='#180405', linewidth=1.5)
para volante en p2['volantes']:
flier.set(marker='o', color='y', alpha=0.5)
ax1.set( xlabel=' Direcciones', ylabel='WRMS/mm')
ax2.set(xlabel='Direcciones', ylabel='WRMS/mm')
ax1.set_title( 'Antes de filtrar ')
ax2.set_title('Después del filtrado')
plt.tight_layout()
#plt.subplots_adjust(izquierda=0.129, abajo =0.11, right=0.9, top=0.88, wspace=0.2, hspace=0.2)
#plt.show()
plt.savefig('D:\SoftwareInstallation\SoftwareFile \Pycharm\ PycharmProjects\boxplot\123', ppp=600)
#plt.show()