Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
layout = go.Layout(title='Spectrogram Extraction Example using pyAudioAnalysis',
xaxis=dict(title='time (sec)',),
yaxis=dict(title='Freqs (Hz)',))
def normalize_signal(signal):
signal = np.double(signal)
signal = signal / (2.0 ** 15)
signal = (signal - signal.mean())
return signal / ((np.abs(signal)).max() + 0.0000000001)
if __name__ == '__main__':
[Fs, s] = wavfile.read("../data/sample_music.wav")
s = normalize_signal(s)
[S, t, f] = aF.spectrogram(s, Fs, int(Fs * 0.020), int(Fs * 0.020))
heatmap = go.Heatmap(z=S.T, y=f, x=t)
plotly.offline.plot(go.Figure(data=[heatmap], layout=layout),
filename="temp.html", auto_open=True)
fig = go.Figure(data=[edge_trace, node_trace],
layout=go.Layout(
title='<br>' + title,
titlefont=dict(size=16),
showlegend=False,
hovermode='closest',
margin=dict(b=20, l=5, r=5, t=40),
# annotations=[dict(
# text="Python code: <a href="https://plot.ly/ipython-notebooks/network-graphs/"> https://plot.ly/ipython-notebooks/network-graphs/</a>",
# showarrow=False,
# xref="paper", yref="paper",
# x=0.005, y=-0.002)],
xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
yaxis=dict(showgrid=False, zeroline=False, showticklabels=False)))
plotly.offline.plot(fig, filename='{}.html'.format(output_path), auto_open=False, image_width=1600,
image_height=900, image='png')
),
yaxis2=dict(
title='Number of genomes',
# ~ titlefont=dict(
# ~ color='rgb(148, 103, 189)'
# ~ ),
# ~ tickfont=dict(
# ~ color='rgb(148, 103, 189)'
# ~ ),
overlaying='y',
side='right'
)
)
fig = go.Figure({"data": listtraces, "layout": layout})
plot_url = plotly.offline.plot(fig, filename=os.path.join(out_folder,'GenomeQualityPlot.html'))
i += 1
i = 0
for stableiter in listStableIter:
verboseprint( "At threshold " + str(thresholdlist[i]) + " it stabilized at the iteration number " + str(stableiter) )
i += 1
print (starttime)
print ("Finished Script at : " + time.strftime("%H:%M:%S-%d/%m/%Y"))
from plotly import tools as tools
fig = tools.make_subplots(rows=1, cols=3,
subplot_titles=(
"expected occupancies, beta={}".format(beta1),
"expected occupancies, beta={}".format(beta2),
"abs difference in ex. occupancies"))
fig['layout'].update(title=title)
for t in data1:
fig.append_trace(t, 1, 1)
for t in data2:
fig.append_trace(t, 1, 2)
for t in data3:
fig.append_trace(t, 1, 3)
# py.plot(fig, filename="output/beta_versus.html")
py.plot(fig, filename="output/beta_versus_{}.html".format(100+uid),
image='png', image_filename="output/beta_versus_{}.png".format(100+uid),
image_width=1400, image_height=750)
ticks[0] = start.strftime('%I:%M %p')
for i in range(30, 60*24, 30):
ticks[i] = (start + timezone.timedelta(minutes=i)).strftime('%I:%M %p')
layout_args['yaxis']['title'] = _('Time of day')
layout_args['yaxis']['rangemode'] = 'tozero'
layout_args['yaxis']['tickmode'] = 'array'
layout_args['yaxis']['tickvals'] = list(ticks.keys())
layout_args['yaxis']['ticktext'] = list(ticks.values())
layout_args['yaxis']['tickfont'] = {'size': 10}
fig = go.Figure({
'data': traces,
'layout': go.Layout(**layout_args)
})
output = plotly.plot(fig, output_type='div', include_plotlyjs=False)
return utils.split_graph_output(output)
layout_args = utils.default_graph_layout_options()
layout_args['title'] = _('<b>Average Feeding Durations</b>')
layout_args['xaxis']['title'] = _('Date')
layout_args['xaxis']['rangeselector'] = utils.rangeselector_date()
layout_args['yaxis']['title'] = _('Average duration (minutes)')
layout_args['yaxis2'] = dict(layout_args['yaxis'])
layout_args['yaxis2']['title'] = _('Number of feedings')
layout_args['yaxis2']['overlaying'] = 'y'
layout_args['yaxis2']['side'] = 'right'
fig = go.Figure({
'data': [trace_avg, trace_count],
'layout': go.Layout(**layout_args)
})
output = plotly.plot(fig, output_type='div', include_plotlyjs=False)
return utils.split_graph_output(output)
def save_graph(data, layout):
"""Quick binder to dump plotly data and layout."""
fig = go.Figure(data=data, layout=layout)
return py.plot(fig, output_type='div', auto_open=False,
show_link=False, include_plotlyjs=False)
def show(self, filename=None, offline=True):
if offline:
from plotly.offline import plot
else:
from plotly.plotly import plot
plot(self.figure, filename=filename, config=self._config)
def plot_changes(df_plot, group):
created_line = go.Scatter(
name='Created',
x=df_plot.index,
y=df_plot['created'])
submitted_line = go.Scatter(
name='Merged',
x=df_plot.index,
y=df_plot['merged'])
updated_line = go.Scatter(
name='Updated',
x=df_plot.index,
y=df_plot['updated'])
plot_title = "Changes/PRs (%s projects)" % group
changes_plot = plotly.offline.plot(
{
"data": [created_line, submitted_line, updated_line],
"layout": go.Layout(title=plot_title)
},
show_link=False,
output_type='div',
include_plotlyjs='False')
return changes_plot
tasks)]['task_status_name'] == 'running'),
name=app)
for app, tasks in apps_dict.items()] +
[go.Scatter(x=df_status['timestamp'],
y=y_axis_setup(
df_status['task_status_name'] == 'running'),
name='all')],
layout=go.Layout(xaxis=dict(tickformat='%m-%d\n%H:%M:%S',
autorange=True,
title='Time'),
yaxis=dict(tickformat=',d',
title='Tasks'),
hovermode='closest',
title='Tasks per app'))
return plot(fig, show_link=False, output_type="div", include_plotlyjs=False)