# -*- coding: utf-8 -*- """ Created on Sat Mar 7 10:41:51 2020 @author: Johan Rene van Dorp """ import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv('SoftwareFailure.csv') FailTimes = df["FailureTimes"] # Plotting Boxplot with two panels plt.rc('font', family='serif', size='10') plt.figure(figsize=(10, 5)) BoxPlot_Figure = plt.figure() BoxPlot_Figure.set_figwidth(9) BoxPlot_Figure.set_figheight(4.5) BoxPlot_Figure.subplots_adjust(hspace=0.4, wspace=0.4) # Plotting the left panel box plot Left_Panel = BoxPlot_Figure.add_subplot(1,1,1) box_LP=plt.boxplot(FailTimes,notch='True',patch_artist=True) plt.ylabel('Data',size='12') # changing the fill color of the box plot colors = ['LightSalmon'] for patch, color in zip(box_LP['boxes'], colors): patch.set_facecolor(color) # changing color and linewidth of # medians for median in box_LP['medians']: median.set(color ='red', linewidth = 2) # Adding Jitter to the Boxplot y = FailTimes jitter = np.random.normal(0.75, 0.04, size=len(y)) plt.scatter(jitter, y, alpha=0.4, color='gray',s=5) # Setting the x-axis labels Left_Panel.set_xticklabels(['Interfailure Times'],size='12') BoxPlot_Figure.suptitle('Boxplot of Succesive Software Interfailure Times',size='14') plt.savefig('SofwareFailure_Box.png', dpi=300)