def main(): original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) series_x = ds.datetime_data() series_y1 = ds.random_data() series_y2 = ds.random_data() fig, ax = ds.plot_scatter_scatter_x_y1_y2(X=series_x, y1=series_y1, y2=series_y2) fig.savefig(fname='plot_scatter_scatter_x_y1_y2_datex_test.svg', format='svg') ds.html_figure(file_name='plot_scatter_scatter_x_y1_y2_datex_test.svg') series_x = ds.random_data(distribution='uniform') fig, ax = ds.plot_scatter_scatter_x_y1_y2(X=series_x, y1=series_y1, y2=series_y2, figsize=(8, 5), marker1='o', marker2='+', markersize1=8, markersize2=12, colour1='#cc3311', colour2='#ee3377', labellegendy1='y1', labellegendy2='y2') ax.legend(frameon=False) fig.savefig(fname='plot_scatter_scatter_x_y1_y2_test.svg', format='svg') ds.html_figure(file_name='plot_scatter_scatter_x_y1_y2_test.svg') ds.html_end(original_stdout=original_stdout, output_url=output_url)
def plot_recent_activity(activity: Optional[pd.DataFrame] = None) -> None: """ Line plot of number commits versus date. Parameters ---------- activity : pd.DataFrame """ figsize = (12, 6) title = 'Daily commits' y_label = 'Number of commits' x_label = 'Date' if activity is None: activity = recent_activity() commits = activity.reset_index().groupby('date').agg('sum') commits['low'] = commits['commits'].where(commits['commits'].between(0, 0)) fig, ax = ds.plot_line_x_y(X=commits.index, y=commits['commits'], figsize=figsize) ax.plot(commits['low'], marker='x', color='#cc3311') ax.xaxis.set_major_formatter(mdates.DateFormatter('%m-%d')) ax.set_ylabel(ylabel=y_label, fontweight='bold') ax.set_xlabel(xlabel=x_label, fontweight='bold') ax.set_title(label=title, fontweight='bold') median_value = commits['commits'].median() ax.axhline(y=median_value, color='#33bbee', label=int(median_value)) ax.legend(frameon=False) ds.despine(ax) fig.savefig(fname='commits_daily.svg', format='svg') ds.html_figure(file_name="commits_daily.svg") print(f'Commits by date\n{commits}\n') print(f"Median commits: {median_value.astype(dtype='int')}\n") print(f"Commits by ascending value\n{commits.sort_values(by='commits')}\n") print(f"Median commits: {median_value.astype(dtype='int')}")
def plot_scatter_y(t: pd.Series) -> None: y, feature = t fig, ax = ds.plot_scatter_y(y=y, figsize=figsize) ax.set_ylabel(ylabel=feature) ax.set_title(label='Time Series') ds.despine(ax) fig.savefig(fname=f'time_series_{feature}.svg', format='svg') ds.html_figure(file_name=f'time_series_{feature}.svg', caption=f'time_series_{feature}.svg')
def main(): original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) data = ds.random_data() fig, ax = ds.probability_plot(data=data) fig.savefig(fname='probability_plot_test.svg', format='svg') ds.html_figure(file_name='probability_plot_test.svg') ds.html_end(original_stdout=original_stdout, output_url=output_url)
def main(): original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) print(help(ds.plot_pareto)) # Example 1 data = pd.DataFrame({ 'ordinate': ['Mo', 'Larry', 'Curly', 'Shemp', 'Joe'], 'abscissa': [21, 2, 10, 4, 16] }) fig, ax1, ax2 = ds.plot_pareto(X=data['ordinate'], y=data['abscissa']) fig.savefig(fname='pareto.svg', format='svg') ds.html_figure(file_name='pareto.svg') ds.html_end(original_stdout=original_stdout, output_url=output_url)
def main(): original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) # Example 1 series_x = ds.datetime_data() series_y = ds.random_data() fig, ax = ds.plot_line_x_y(X=series_x, y=series_y) fig.savefig(fname='plot_line_x_y_datex_test.svg', format='svg') ds.html_figure(file_name='plot_line_x_y_datex_test.svg') # Example 2 series_x = ds.random_data(distribution='randint').sort_values() fig, ax = ds.plot_line_x_y(X=series_x, y=series_y, figsize=(8, 4.5), marker='o', markersize=8, linestyle=':', colour='#337733') fig.savefig(fname='plot_line_x_y_intx_test.svg', format='svg') ds.html_figure(file_name='plot_line_x_y_intx_test.svg') # Example 3 series_x = ds.random_data(distribution='uniform').sort_values() fig, ax = ds.plot_line_x_y(X=series_x, y=series_y) fig.savefig(fname='plot_line_x_y_uniformx_test.svg', format='svg') ds.html_figure(file_name='plot_line_x_y_uniformx_test.svg') # Example 4 series_x = ds.random_data().sort_values() fig, ax = ds.plot_line_x_y(X=series_x, y=series_y) fig.savefig(fname='plot_line_x_y_normx_test.svg', format='svg') ds.html_figure(file_name='plot_line_x_y_normx_test.svg') ds.html_end(original_stdout=original_stdout, output_url=output_url)
def main(): start_time = time.time() global figsize, date_time_parser file_names, graph_file_names, abscissa_names, ordinate_names,\ ordinate_predicted_names, x_axis_label, y_axis_label, axis_title,\ figsize, column_names_sort, date_time_parser,\ date_formatter, alpha_value, function, output_url,\ header_title, header_id, parser = parameters() original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) print('<pre style="white-space: pre-wrap;">') for (file_name, abscissa_name, ordinate_name, ordinate_predicted_name, date_time_parser, column_names_sort, date_formatter, graph_file_name) in zip(file_names, abscissa_names, ordinate_names, ordinate_predicted_names, date_time_parser, column_names_sort, date_formatter, graph_file_names): if date_time_parser == 'None': data = ds.read_file(file_name=file_name, sort_columns=column_names_sort, sort_columns_bool=True) else: data = ds.read_file(file_name=file_name, parse_dates=[abscissa_name], sort_columns=column_names_sort, sort_columns_bool=True) data[ordinate_predicted_name] = data[ordinate_name]\ .ewm(alpha=alpha_value).mean() fig, ax = ds.plot_scatter_line_x_y1_y2( X=data[abscissa_name], y1=data[ordinate_name], y2=data[ordinate_predicted_name], figsize=figsize) ax.set_title(label=axis_title, fontweight='bold') ax.set_xlabel(xlabel=x_axis_label, fontweight='bold') ax.set_ylabel(ylabel=y_axis_label, fontweight='bold') ds.despine(ax=ax) fig.savefig(fname=f'{graph_file_name}.svg', format='svg') ds.html_figure(file_name=f'{graph_file_name}.svg') ds.page_break() stop_time = time.time() ds.report_summary(start_time=start_time, stop_time=stop_time, read_file_names=file_names, targets=ordinate_names, features=abscissa_names) print('</pre>') ds.html_end(original_stdout=original_stdout, output_url=output_url)
def main(): original_stdout = ds.html_begin( output_url=output_url, header_title=header_title, header_id=header_id ) # Example 1 series_y = ds.random_data() fig, ax = ds.plot_scatter_y(y=series_y) fig.savefig(fname="plot_scatter_y_test_1.svg", format="svg") ds.html_figure(file_name="plot_scatter_y_test_1.svg") # Example 2 fig, ax = ds.plot_scatter_y( y=series_y, figsize=(8, 4.5), marker="o", markersize=4, colour="#ee7733" ) fig.savefig(fname="plot_scatter_y_test_2.svg", format="svg") ds.html_figure(file_name="plot_scatter_y_test_2.svg") ds.html_end(original_stdout=original_stdout, output_url=output_url)
def xbar_chart(df: pd.DataFrame) -> NoReturn: ''' Creates an Xbar control chart. Identifies out-of-control points. Adds cart and axis titles. Saves the figure in svg format. ''' fig = plt.figure(figsize=(8, 6)) xbar = cc.Xbar(df) ax = xbar.ax(fig) ax.axhline(y=xbar.sigmas[+1], linestyle='--', dashes=(5, 5), color=colour, alpha=0.5) ax.axhline(y=xbar.sigmas[-1], linestyle='--', dashes=(5, 5), color=colour, alpha=0.5) ax.axhline(y=xbar.sigmas[+2], linestyle='--', dashes=(5, 5), color=colour, alpha=0.5) ax.axhline(y=xbar.sigmas[-2], linestyle='--', dashes=(5, 5), color=colour, alpha=0.5) cc.draw_rule(xbar, ax, *cc.points_one(xbar), '1') cc.draw_rule(xbar, ax, *cc.points_four(xbar), '4') cc.draw_rule(xbar, ax, *cc.points_two(xbar), '2') cc.draw_rules(xbar, ax) ax.set_title(label=xbar_chart_title, fontweight='bold') ax.set_ylabel(ylabel=xbar_chart_ylabel) ax.set_xlabel(xlabel=xbar_chart_xlabel) fig.savefig(fname=f'{data_file}_xbar.svg') ds.html_figure(file_name=f'{data_file}_xbar.svg') print(f'Xbar Report\n' f'===================\n' f'UCL : {xbar.ucl.round(3)}\n' f'Xbarbar : {xbar.mean.round(3)}\n' f'LCL : {xbar.lcl.round(3)}\n' f'Sigma(Xbar): {xbar.sigma.round(3)}\n')
def main(): original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) # Example 1 series_y = ds.random_data() fig, ax = ds.plot_line_y(y=series_y) fig.savefig(fname='plot_line_y_test_1.svg', format='svg') ds.html_figure(file_name='plot_line_y_test_1.svg') # Example 2 fig, ax = ds.plot_line_y(y=series_y, figsize=(8, 4.5), marker='o', markersize=4, linestyle=':', colour='#ee7733') fig.savefig(fname='plot_line_y_test_2.svg', format='svg') ds.html_figure(file_name='plot_line_y_test_2.svg') ds.html_end(original_stdout=original_stdout, output_url=output_url)
def main(): start_time = time.time() original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) data = ds.random_data(distribution='norm', size=42, loc=69, scale=13) data = pd.DataFrame(data=data, columns=['X']) # print('dtype:', type(data).__name__) # print(data.head()) # Create X control chart ds.page_break() fig = plt.figure(figsize=figsize) x = cc.X(data=data) # print('class:', type(x).__name__) ax = x.ax(fig) fig.savefig(fname=graph_x_file_name) ds.html_figure(file_name=graph_x_file_name) print(f'X Report\n' f'============\n' f'UCL : {x.ucl.round(3)}\n' f'Xbar : {x.mean.round(3)}\n' f'LCL : {x.lcl.round(3)}\n' f'Sigma(X) : {x.sigma.round(3)}\n') # Create mr chart fig = plt.figure(figsize=figsize) mr = cc.mR(data=data) # print('class:', type(x).__name__) ax = mr.ax(fig) fig.savefig(fname=graph_mr_file_name) ds.html_figure(file_name=graph_mr_file_name) print(f'mR Report\n' f'============\n' f'UCL : {mr.ucl.round(3)}\n' f'mRbar : {mr.mean.round(3)}\n' f'LCL : {round(mr.lcl, 3)}\n' f'Sigma(mR) : {mr.sigma.round(3)}\n') stop_time = time.time() ds.page_break() ds.report_summary(start_time=start_time, stop_time=stop_time) ds.html_end(original_stdout=original_stdout, output_url=output_url)
def mr_chart(df: pd.DataFrame) -> NoReturn: ''' Creates an mR control chart. Identifies out-of-control points. Adds chart and axis titles. Saves the figure in svg format. ''' fig = plt.figure(figsize=figsize) mr = cc.mR(data=df) ax = mr.ax(fig) cc.draw_rule(mr, ax, *cc.points_one(mr), '1') ax.set_title(label=mr_chart_title, fontweight='bold') ax.set_ylabel(ylabel=mr_chart_ylabel) ax.set_xlabel(xlabel=mr_chart_xlabel) fig.savefig(fname=f'{data_file}_mr.svg') ds.html_figure(file_name=f'{data_file}_mr.svg') print(f'mR Report\n' f'===================\n' f'UCL : {mr.ucl.round(3)}\n' f'mRbar : {mr.mean.round(3)}\n' f'LCL : {round(mr.lcl, 3)}\n' f'Sigma(mR) : {mr.sigma.round(3)}\n')
def main(): start_time = time.time() global figsize, axis_title, x_axis_label, y_axis_label,\ graphics_directory file_names, targets, features, number_knots, graphics_directory,\ figsize, x_axis_label, y_axis_label, axis_title,\ date_parser, output_url, header_title, header_id = parameters() ds.create_directory(directories=graphics_directory) original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) ds.page_break() for file_name, target, feature in zip(file_names, targets, features): data = ds.read_file(file_name=file_name, parse_dates=features) data[target] = data[target].fillna(data[target].mean()) dates = True X = pd.to_numeric(data[feature]) y = data[target] t = ((X, y, file_name, target, feature, knot, dates) for knot in number_knots) with Pool() as pool: for _ in pool.imap_unordered(plot_scatter_line, t): pass for knot in number_knots: ds.html_figure(file_name=f'{graphics_directory}/' f'spline_{file_name.strip(".csv")}_' f'{target}_{feature}_{knot}.svg') stop_time = time.time() ds.page_break() ds.report_summary(start_time=start_time, stop_time=stop_time, read_file_names=file_names, targets=targets, features=features, number_knots=number_knots) ds.html_end(original_stdout=original_stdout, output_url=output_url)
def main(): original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) # Example 1 series_x1 = ds.datetime_data() series_x2 = ds.datetime_data() series_y1 = ds.random_data() series_y2 = ds.random_data() fig, ax = ds.plot_scatter_scatter_x1_x2_y1_y2(X1=series_x1, X2=series_x2, y1=series_y1, y2=series_y2) fig.savefig(fname='plot_scatter_scatter_x1_x2_y1_y2_datex_test.svg', format='svg') ds.html_figure(file_name='plot_scatter_scatter_x1_x2_y1_y2_datex_test.svg') # Example 2 fig, ax = ds.plot_scatter_scatter_x1_x2_y1_y2( X1=series_x1, X2=series_x2, y1=series_y1, y2=series_y2, smoothing='natural_cubic_spline', number_knots=7) fig.savefig(fname=('plot_scatter_scatter_x1_x2_y1_y2_' 'datex_smoothing_y1_y2_test.svg'), format='svg') ds.html_figure(file_name=( 'plot_scatter_scatter_x1_x2_y1_y2_datex_smoothing_y1_y2_test.svg')) # Example 3 series_x1 = ds.random_data(distribution='uniform').sort_values() series_x2 = ds.random_data(distribution='uniform').sort_values() fig, ax = ds.plot_scatter_scatter_x1_x2_y1_y2(X1=series_x1, X2=series_x2, y1=series_y1, y2=series_y2, figsize=(8, 5), marker1='o', marker2='+', markersize1=8, markersize2=12, colour1='#cc3311', colour2='#ee3377', labellegendy1='y1', labellegendy2='y2') ax.legend(frameon=False) fig.savefig(fname='plot_scatter_scatter_x1_x2_y1_y2_test.svg', format='svg') ds.html_figure(file_name='plot_scatter_scatter_x1_x2_y1_y2_test.svg') # Example 4 fig, ax = ds.plot_scatter_scatter_x1_x2_y1_y2( X1=series_x1, X2=series_x2, y1=series_y1, y2=series_y2, figsize=(8, 5), marker1='o', marker2='+', markersize1=8, markersize2=12, colour1='#cc3311', colour2='#ee3377', labellegendy1='y1', labellegendy2='y2', smoothing='natural_cubic_spline', number_knots=7) ax.legend(frameon=False) fig.savefig( fname='plot_scatter_scatter_x1_x2_y1_y2_smoothing_y1_y2_test.svg', format='svg') ds.html_figure( file_name='plot_scatter_scatter_x1_x2_y1_y2_smoothing_y1_y2_test.svg') ds.html_end(original_stdout=original_stdout, output_url=output_url)
print() print('Root mean squared error') print(round(math.sqrt(mse), 3)) ds.page_break() # Scatter plot of predicted versus measured fig, ax = ds.plot_scatter_x_y(X=y_all, y=predicted, figsize=figsize) ax.plot([y_all.min(), y_all.max()], [y_all.min(), y_all.max()], marker=None, linestyle='-', color=colour2) ax.set_ylabel(ylabel=label_predicted) ax.set_xlabel(xlabel=label_measured) ax.set_title(label=title) ds.despine(ax) fig.savefig(fname=f'{graph_name}_scatter.svg', format='svg') ds.html_figure(file_name=f'{graph_name}_scatter.svg', caption=f'{graph_name}_scatter.svg') # Line plot of predicted versus measured fig, ax = ds.plot_line_line_y1_y2(y1=y_all, y2=predicted, figsize=figsize, labellegendy1=label_measured, labellegendy2=label_predicted) ax.legend(frameon=False) ax.set_title(label=title) ds.despine(ax) fig.savefig(fname=f'{graph_name}_lines.svg', format='svg') ds.html_figure(file_name=f'{graph_name}_lines.svg', caption=f'{graph_name}_lines.svg') stop_time = time.time() ds.page_break() ds.report_summary(start_time=start_time, stop_time=stop_time)
def main(): data_pumps = { 'x': [8.7, 11, 13.4, 14.9, 8.7, 8.9, 12.6, 10.7, 13.5, 16.4, 18.9, 16, 9], 'y': [17.9, 18.5, 17.4, 17.8, 14.9, 12.8, 11.7, 7.4, 8, 9.3, 9.7, 5, 5.1] } data_deaths = { 'x': [ 13.6, 9.9, 14.7, 15.2, 13.2, 13.8, 13.1, 11, 15.2, 11.1, 11.7, 12.3, 10.6, 14.6, 16.6, 9.5, 13.3, 15, 15.1, 10.9, 12.5, 11.8, 12.2, 13.9, 12.3, 11, 11, 13.5, 10.8, 12.2, 13.9, 12.5, 15.7, 12.9, 13, 13.7, 13.1, 13.4, 14.8, 13.2, 9.8, 12.5, 13.4, 14.4, 16, 10.9, 12.5, 15.8, 16.5, 11.2, 15.8, 11, 11.7, 11.5, 11.8, 13, 14.1, 14.8, 12.6, 14.6, 12.5, 14.5, 9.2, 17.9, 11.2, 9.5, 10.8, 16.1, 10.4, 13.7, 15.8, 12.2, 11.5, 15.4, 15.9, 10.2, 14, 16.5, 17.5, 13.8, 14.1, 14.7, 12.6, 11.7, 14.4, 15.2, 15.8, 13.9, 15.2, 13.2, 12.7, 15.1, 12.8, 13.6, 14, 15.4, 14.8, 10.3, 10.5, 9.9, 14.2, 13.6, 15, 15.7, 9.2, 16.8, 13.3, 10.6, 8.3, 13.4, 14.5, 16.8, 14.7, 10.3, 13.2, 9.1, 15.2, 8.4, 15.3, 13.3, 13.2, 12.6, 13.9, 13.5, 15.2, 11.6, 9.4, 11.4, 11.2, 11.9, 15, 13.6, 14.1, 10.5, 10.3, 13.8, 13.4, 12.6, 15.7, 13.8, 13.2, 15.1, 13.2, 14.6, 14.4, 15, 13.1, 13.4, 11.8, 16, 10.6, 14.6, 9.3, 14.5, 10.5, 14, 10.6, 10.6, 15.7, 11.8, 11.8, 11.6, 15.8, 10.7, 13.4, 11.2, 15.5, 14, 13.4, 14.6, 15.3, 14.5, 11.4, 12.5, 13.8, 10.6, 10.5, 14.8, 14.2, 13.3, 10.4, 12.5, 15, 10.6, 13.1, 10.1, 11.2, 12.9, 12.2, 12.4, 11.9, 11.5, 11.7, 12.5, 14.8, 14, 12.5, 9.2, 10.4, 12.7, 9.1, 8.3, 15.3, 11.2, 11.8, 12.7, 11.8, 12.2, 12.7, 13.6, 8.8, 12.2, 16.2, 12.8, 13.6, 12.7, 15, 13.9, 13.6, 12.5, 9.9, 17.6, 11.1, 16.7, 9.7, 13.4, 13.1, 13.7, 11.7, 13.1, 13.1, 12.3, 14.9, 11.5, 12.9, 11, 15.8, 12.9, 12.3, 9.8, 12.7, 12.7, 16, 11, 14.1, 11, 14.5, 15.6, 9.6, 15.5, 14.4, 11.4, 13.7, 11.4, 16, 9.9, 10.8, 12.6, 9.3, 13.8, 13.8, 14.7, 15.3, 14.1, 13.8, 11, 12.4, 14.8, 15, 15.4, 12.8, 11.3, 10.5, 11, 13.4, 10.3, 9.6, 14.5, 11.5, 12.7, 15, 12.3, 12.9, 15.3, 15.8, 13.1, 12.9, 15.3, 13, 12.5, 15.8, 14, 13, 13.9, 10.9, 16, 15.1, 13.5, 11.6, 10.7, 16.8, 13.9, 13.7, 13.3, 15.7, 15.5, 11, 15.5, 11.7, 12.4, 11.1, 9.6, 8.3, 14, 13.2, 15.3, 15.5, 15.4, 16.1, 12.4, 12.2, 15.1, 14, 9.6, 16.3, 12.6, 10.5, 14, 15.5, 11, 13.3, 13.9, 13.3, 12.7, 15.4, 15.7, 13.8, 11.7, 16.1, 12.6, 15.4, 16.3, 12.5, 15.7, 11.5, 14.2, 16.3, 13.6, 12.6, 11.7, 8.8, 10.9, 11.6, 13, 13.7, 11.1, 14.6, 10.4, 13.1, 11.9, 13.3, 9.9, 12.7, 9.3, 11.6, 13.1, 11.4, 13.6, 11.8, 16.3, 8.7, 15.7, 12.2, 14.8, 13.5, 15.7, 11.9, 12.5, 14.4, 12.2, 15.3, 11.5, 9, 10.8, 14.9, 13.2, 13.4, 14.4, 12.2, 12, 13.6, 8.8, 13.4, 12.6, 15.6, 12.5, 12.4, 12.4, 13.4, 12, 9.9, 12.1, 14.4, 15.7, 13.8, 11.4, 13.8, 15.6, 15, 14.1, 13.2, 13.3, 10.9, 12.1, 14, 11.3, 13.4, 13.5, 14.8, 13, 12.4, 12.3, 13.1, 14.8, 9.8, 14.1, 12, 16.1, 12.7, 14.7, 8.8, 10.5, 12.2, 11.7, 8.3, 12.4, 16.7, 15.7, 16.1, 14.3, 9.7, 13.3, 16.1, 14.4, 13.4, 14.5, 14.6, 13.7, 16.2, 16.3, 12.8, 13.4, 11.2, 11.6, 14.7, 9.4, 9.5, 15.7, 14.3, 14.2, 11.5, 15, 13.1, 11, 11.9, 13.5, 14.1, 10.9, 14.2, 10.4, 15.6, 11.3, 13, 13.6, 11.1, 14.6, 15.2, 13.4, 16.1, 14.3, 16.4, 12.6, 13.3, 11, 10.1, 15.6, 14.2, 13.4, 10.8, 13.2, 13.8, 11.4, 12.9, 13.6, 13.3, 12.2, 14.4, 8.9, 15.5, 14.3, 10, 13.2, 10.5, 9.5, 10.4, 10.9, 13.3, 12.6, 13.1, 11.6, 13.6, 13.4, 13.7, 10.7, 12.2, 14, 14.8, 15.1, 16.2, 15.3, 12.5, 14.7, 12.5, 10.9, 15.7, 11.7, 9.5, 13.3, 13.6, 13.4, 13.5, 11.1, 12.9, 12.8, 15.3, 12.8, 9.2, 14.4, 15.6, 10.4, 13, 13.2, 11, 13.5, 9.6, 14.5, 12.5, 10.7, 13.3, 9.4, 13.4, 13.5, 13.5, 13.6, 14.3, 9.6, 14.1, 12.9, 15.4, 13.8, 11.4, 12.4, 12.7, 13.6, 14.1, 15.1, 15.3, 14.7, 13.4, 12.3, 14.3, 12.4, 12.1, 12.4, 15.1, 17.3, 12.4, 15 ], 'y': [ 11.1, 12.6, 10.2, 10, 13, 8.9, 10.6, 11.9, 11.7, 9.6, 13.6, 11.5, 11.9, 10.6, 14.3, 10.7, 10.7, 10.2, 10, 9.8, 12, 11.8, 10.4, 12.8, 11.9, 11.9, 9.8, 13.3, 11.7, 13.6, 14, 11.6, 12.7, 9.9, 10.2, 11.4, 11.1, 11.1, 9.4, 13.2, 12.5, 12, 10.2, 11.6, 14.2, 12, 13.4, 12.4, 14.3, 8.6, 12.2, 9.8, 13.6, 12.3, 15.1, 13.9, 13.1, 10, 11, 12.9, 11.2, 8.7, 10.8, 7.2, 14.7, 10.7, 9.9, 14.1, 10.6, 9, 13.9, 11.8, 10.7, 11.2, 12.2, 11.9, 12.8, 11.4, 11.2, 8.9, 10.6, 11.5, 13.4, 10.4, 12.6, 17, 13.9, 12.7, 11.6, 12.9, 11.3, 13.2, 11.6, 13.2, 13.1, 13.3, 14.9, 11.4, 11.6, 12.3, 9.2, 12.5, 9.8, 12.4, 12, 11.4, 10.3, 11.6, 7.2, 13, 8.7, 11.4, 11.9, 11.4, 11.2, 13.2, 10, 7.4, 9.8, 12.4, 9.7, 11.5, 11, 12.5, 17, 11.1, 10.8, 9.6, 14.8, 10.2, 10.2, 11.5, 13.6, 11.2, 9.5, 12.7, 12.4, 11, 13.9, 8.9, 12.3, 10.1, 10.5, 11.4, 10.3, 14.1, 10.6, 8.8, 9.5, 14.4, 10.9, 10.6, 12.2, 11.5, 12.3, 12.8, 11.6, 11.7, 6.1, 11.2, 10.3, 11.1, 14, 11.7, 13.3, 11.5, 12.8, 10.7, 12.5, 16.2, 13.4, 8.8, 9.9, 11.2, 11.2, 11, 11, 10.8, 12, 12, 11.8, 10.6, 12, 9.9, 11.1, 11.5, 11.4, 11.7, 10, 11.3, 10.2, 11.4, 13.6, 11.5, 12.3, 12.7, 13.4, 12.3, 11.3, 9.2, 6.3, 7.1, 13.6, 11.4, 11.2, 11.3, 11.2, 13.6, 11.3, 13.4, 15.1, 11.3, 14.3, 11.6, 13.4, 10.2, 11.9, 12.7, 9.1, 13, 12.4, 7.3, 11.1, 14.4, 11, 13, 10.6, 10.1, 11.1, 11.8, 11.8, 11.9, 12.8, 12.6, 11.6, 11.2, 14, 10.3, 11.5, 11.8, 11.3, 12.1, 9.2, 11.9, 9.3, 11.7, 8.7, 11.3, 11.8, 11.1, 12.2, 9.9, 11.3, 11, 9.1, 11.9, 9.7, 11.6, 10.7, 13.8, 13.8, 10, 10, 12.4, 10.1, 11.3, 10.5, 10, 13.6, 13.5, 14.3, 9.8, 11.8, 11.2, 9.5, 11.4, 11.8, 12.3, 11.4, 10.7, 12, 14.8, 10.8, 9.1, 9.6, 13.9, 11.7, 12.1, 11.8, 11.2, 13, 13.4, 14.4, 14.6, 9.7, 14, 10.1, 12.6, 12.3, 12, 11.6, 14.6, 11.1, 9.6, 12.4, 11.2, 11.2, 11.1, 9.6, 11.4, 11.5, 10.9, 7.2, 13.3, 13, 9.3, 11.2, 7.3, 14.3, 13.7, 11.8, 11.7, 12.9, 10.9, 14.3, 10.6, 12.9, 12.8, 11.3, 11.2, 12.9, 13.6, 9.6, 10.7, 11.2, 13.9, 11.1, 10.5, 14.3, 11, 11.3, 14.4, 12.1, 12.9, 12.6, 12.1, 10.1, 11.2, 10.4, 11.2, 10.9, 14.7, 11.1, 11.2, 11.3, 11.8, 12.3, 11.6, 12.3, 14.2, 10.3, 12.2, 12.8, 10.6, 9.5, 12.3, 11, 11.5, 13.6, 14.4, 12.1, 12.2, 11.4, 14.1, 8.9, 12.9, 14.2, 12.8, 13.1, 14.1, 11.4, 10.8, 11.2, 8.8, 10.1, 11.9, 8.8, 12, 11.4, 14.6, 11.6, 12, 11, 12.8, 14.2, 12, 11.3, 11.4, 12.6, 11.4, 11.8, 13.6, 13.1, 12.9, 11.1, 10.9, 14.2, 11.3, 10.2, 13.1, 9.8, 13, 12, 10, 13.9, 10.8, 13, 12.5, 12, 11, 11.3, 14.8, 12.4, 13.2, 12.5, 10.6, 14.6, 14.2, 11.3, 10.1, 12.1, 12.3, 14.2, 13.6, 11.6, 13.2, 8.4, 7.2, 14.3, 10.5, 12.4, 12.9, 10, 10.4, 10.9, 9, 11.4, 13.9, 14.2, 14.4, 14.3, 11.9, 8.6, 12.2, 11.9, 10.8, 10.7, 11.6, 12.5, 13.4, 10.4, 10.4, 12.4, 12, 14.2, 8.9, 13.1, 16.5, 9.4, 11.2, 11.3, 11.5, 9.6, 13.1, 11.6, 11.4, 8.6, 10.4, 10.9, 10.4, 14.4, 15, 10.8, 12.1, 10.6, 12.6, 13.4, 12.5, 11.6, 10.6, 12.6, 11, 9.8, 11.1, 14.3, 11.4, 10.3, 12.1, 14.2, 10.4, 11.3, 14.3, 12.5, 10.6, 11.2, 14.6, 11, 11, 14.2, 10.5, 10.1, 13.1, 11.1, 12.5, 14.1, 13.3, 9.2, 10.1, 9.9, 11.4, 11.1, 11.4, 11.1, 14.7, 12.9, 12.6, 11.5, 14.8, 15.3, 10.3, 12.5, 11.1, 10.9, 16, 9.8, 11.3, 11.1, 12, 10.9, 11.2, 10.7, 11.9, 9.7, 11, 10.6, 10.6, 11.1, 12.5, 12.9, 11, 11.9, 11.1, 11, 9.1, 15.6, 10.6, 15.5, 13.8, 13.8, 12.7, 9.9, 11.4, 11.3, 11.5, 13.1, 10.1, 13.6, 10.2, 12.5, 11.9, 10.4, 11.6, 10.3, 11.5, 10.2, 11.6, 11.9, 12.5 ] } x_axis_label = 'X distance from lower left datum of map (m)' y_axis_label = 'Y distance from lower left datum of map (m)' axis_title = 'Broad Street Cholera Outbreak of 1854' file_graph = 'broad_street_cholera_outbreak.svg' output_url = 'broad_street_cholera.html' header_title = 'broad_street_cholera' header_id = 'broad-street-cholera' axis_subtitle = 'Soho, London, UK' legend1 = 'Deaths' legend2 = 'Pumps' figsize = (8, 6) ds.style_graph() original_stdout = ds.html_begin(output_url=output_url, header_title=header_title, header_id=header_id) deaths = pd.DataFrame(data=data_deaths) pumps = pd.DataFrame(data=data_pumps) fig, ax = ds.plot_scatter_scatter_x1_x2_y1_y2(X1=deaths['x'], X2=pumps['x'], y1=deaths['y'], y2=pumps['y'], figsize=figsize, markersize1=3, labellegendy2=legend2, colour1=colour1, colour2=colour2, markersize2=3, labellegendy1=legend1) ax.set_title(label=axis_title + '\n' + axis_subtitle) ax.set_ylabel(ylabel=y_axis_label) ax.set_xlabel(xlabel=x_axis_label) ax.legend(frameon=False) ds.despine(ax=ax) fig.savefig(fname=file_graph, format='svg') ds.html_figure(file_name=file_graph) ds.html_end(original_stdout=original_stdout, output_url=output_url)