Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
[r[0] for r in rnd_draws], 50,
normed=1, facecolor='green', alpha=0.75
)
self.ax2.cla()
self.ax2.set_xlabel('r2')
self.ax2.set_ylabel('Normalized Distribtuion')
self.ax2.set_xlim(0, 1)
self.ax2.set_ylim(0, 1.5)
self.ax2.grid(True)
self.ax2.hist(
[r[1] for r in rnd_draws], 50,
normed=1, facecolor='blue', alpha=0.75
)
# send new matplotlib plots to frontend
self.emit('mpld3canvas', mpld3.fig_to_dict(self.fig))
return_dict['y_min'] = y_min
return_dict['y_max'] = y_max
fig, ax = plt.subplots(subplot_kw=dict(axisbg='#EEEEEE'))
for alg_dict in list_of_alg_dicts:
ax.plot(alg_dict['x'],alg_dict['y'],label=alg_dict['legend_label'])
ax.set_xlabel('API Call')
ax.set_ylabel('Duration (s)')
ax.set_xlim([x_min,x_max])
ax.set_ylim([y_min,y_max])
ax.grid(color='white', linestyle='solid')
ax.set_title(task, size=14)
legend = ax.legend(loc=2,ncol=3,mode="expand")
for label in legend.get_texts():
label.set_fontsize('small')
plot_dict = mpld3.fig_to_dict(fig)
plt.close()
return plot_dict
def Cat_ViolinPlot(data, x, y=None, hue=None):
sns.set_style("whitegrid")
g = sns.violinplot(x, y, data, hue=hue)
d = mpld3.fig_to_dict(g.figure)
return d
import matplotlib.pyplot as plt
import mpld3
fig, ax = plt.subplots(subplot_kw=dict(axisbg='#EEEEEE'))
for alg_dict in list_of_alg_dicts:
ax.plot(alg_dict['x'],alg_dict['y'],label=alg_dict['legend_label'])
ax.set_xlabel('Number of answered queries')
ax.set_ylabel('Error on hold-out set')
ax.set_xlim([x_min,x_max])
ax.set_ylim([y_min,y_max])
ax.grid(color='white', linestyle='solid')
ax.set_title('Test Error', size=14)
legend = ax.legend(loc=2,ncol=3,mode="expand")
for label in legend.get_texts():
label.set_fontsize('small')
plot_dict = mpld3.fig_to_dict(fig)
plt.close()
return plot_dict
import matplotlib.pyplot as plt
import mpld3
fig, ax = plt.subplots(subplot_kw=dict(axisbg='#FFFFFF'))
ax.hist(numerical_timestamps,int(1+4*numpy.sqrt(len(numerical_timestamps))),alpha=0.5,color='black')
ax.set_axis_off()
# ax.set_xlabel('API Call')
# ax.set_ylabel('Duration (s)')
#ax.set_xlim([x_min,x_max])
#ax.set_ylim([y_min,y_max])
#ax.grid(color='white', linestyle='solid')
# ax.set_title(task, size=14)
# labels = ['point {0}'.format(i + 1) for i in range(N)]
# tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=labels)
# mpld3.plugins.connect(fig, tooltip)
plot_dict = mpld3.fig_to_dict(fig)
return plot_dict
def savehtml(self, filename):
import mpld3
# mpld3.save_html(self.figure,filename)
# mpld3.save_json(self.figure, filename)
mpld3.fig_to_dict(self.figure)
def Reg_RegPlot(data, x, y):
sns.set_style("whitegrid")
g = sns.regplot(x, y, data)
d = mpld3.fig_to_dict(g.figure)
return d
def Cat_LVPlot(data, x, y=None, hue=None):
sns.set_style("whitegrid")
g = sns.lvplot(x, y, data, hue=hue)
d = mpld3.fig_to_dict(g.figure)
return d
def Axis_LMPlot(data, x, y=None, hue=None):
sns.set(color_codes=True)
ax = sns.lmplot(x=x, y=y, hue=hue, data=data)
d = mpld3.fig_to_dict(ax.fig)
return d
fig, ax = plt.subplots(subplot_kw=dict(axisbg='#EEEEEE'))
for alg_dict in list_of_alg_dicts:
ax.plot(alg_dict['x'],alg_dict['y'],label=alg_dict['legend_label'])
ax.set_xlabel('API Call')
ax.set_ylabel('Duration (s)')
ax.set_xlim([x_min,x_max])
ax.set_ylim([y_min,y_max])
ax.grid(color='white', linestyle='solid')
ax.set_title(task, size=14)
legend = ax.legend(loc=2,ncol=3,mode="expand")
for label in legend.get_texts():
label.set_fontsize('small')
# labels = ['point {0}'.format(i + 1) for i in range(N)]
# tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=labels)
# mpld3.plugins.connect(fig, tooltip)
plot_dict = mpld3.fig_to_dict(fig)
return plot_dict