1 import plotly.graph_objs
as go
2 import plotly.express
as px
5 from plotly.subplots
import make_subplots
6 from copy
import deepcopy
8 line_types = [
'solid',
'dot',
'dash',
'longdash',
'dashdot',
'longdashdot']
9 colors = [
'DarkSlateGrey',
'black',
'DarkViolet']
10 markers = [
'circle',
'cross',
'diamond']
11 def plot(fig,data,i,name,x):
15 for tag
in data.columns:
17 mean_value = np.mean(tag_data)
18 std_upp = max(tag_data) - mean_value
19 std_down = mean_value - min(tag_data)
20 means.append(mean_value)
21 max_stds.append(std_upp)
22 min_stds.append(std_down)
23 fig.add_trace(go.Scatter(
36 marker =
dict(size=10,
38 marker_symbol = markers[i]
57 family =
'Times New Roman',
64 paper_bgcolor=
'rgba(0,0,0,0)',
65 plot_bgcolor=
'rgba(0,0,0,0)',
71 family=
'Times New Roman',
75 bordercolor=
'DarkSeaGreen'
96 family =
'Times New Roman',
104 def extract_data(postfix):
105 data = pd.read_csv(
'usage_{}.csv'.format(postfix))
107 if "Unnamed: 0" in data.keys():
108 data = data.drop(
"Unnamed: 0", axis=1)
110 data = map(
lambda postfix: extract_data(postfix),postfixes)
115 memory_data = pd.concat([item[
'Memory'].div(10**6)
for item
in list(deepcopy(data))],axis=1)
116 memory_data.columns = postfixes
117 CPU_data = pd.concat([item[
'CPU']
for item
in list(deepcopy(data))],axis=1)
118 CPU_data.columns = postfixes
120 fig =
plot(fig,memory_data,i = 0,name =
'Memory',x=xs)
121 fig =
plot(fig,CPU_data,i = 2,name =
'CPU',x=[x-0.2
for x
in xs])
123 fig.update_xaxes(automargin=
True,showgrid=
False,zeroline=
False,
124 tickvals = xs,ticktext = postfixes, range = [xs[0]-0.5,xs[-1]+0.5])
125 fig.update_yaxes(range = [0,220])
126 fig.write_image(fig_name+
'.svg')
130 if __name__ ==
'__main__':
137 postfixes = [
'Cpp',
'Py',
'Cppy',
'Pyy']