Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from bokeh.plotting import figure, output_file, show
output_file("outline.html")
p = figure(plot_width=400, plot_height=400)
p.outline_line_width = 7
p.outline_line_alpha = 0.3
p.outline_line_color = "navy"
p.circle([1,2,3,4,5], [2,5,8,2,7], size=10)
show(p)
y = self.account.equity[np.where(self.data['date'] == trade.date.strftime("%Y-%m-%d"))[0][0]]
if trade.type == 'long': p.circle(x, y, size=6, color='green', alpha=0.5)
elif trade.type == 'short': p.circle(x, y, size=6, color='red', alpha=0.5)
except:
pass
for trade in self.account.closed_trades:
try:
x = time.mktime(trade.date.timetuple())*1000
y = self.account.equity[np.where(self.data['date'] == trade.date.strftime("%Y-%m-%d"))[0][0]]
if trade.type == 'long': p.circle(x, y, size=6, color='blue', alpha=0.5)
elif trade.type == 'short': p.circle(x, y, size=6, color='orange', alpha=0.5)
except:
pass
bokeh.plotting.show(p)
s = session('-v2')
maps = [map_thumbnail(100, 120, data)
for data in (activity_statistics(s, SPHERICAL_MERCATOR_X, SPHERICAL_MERCATOR_Y,
ACTIVE_DISTANCE, TOTAL_CLIMB,
activity_journal=aj)
for aj in constrained_sources(s, constraint))
if len(data[SPHERICAL_MERCATOR_X].dropna()) > 10]
print(f'Found {len(maps)} activities')
'''
## Display Maps
'''
output_notebook()
show(htile(maps, 8))
("y", "@y")
]))
# pratio.add_tools(HoverTool(tooltips=[
# ('Name', '$name'),
# ("E", "@x"),
# ("y", "@y")
# ]))
pratio.legend.location = "top_left"
pratio.legend.click_policy = "mute"
layout = column(pmean, pstd, pratio)
show(layout)
areas[cat] = np.hstack((last[::-1], next))
last = next
return areas
areas = stacked(df, categories)
colors = brewer["Spectral"][len(areas)]
x2 = np.hstack((data['x'][::-1], data['x']))
output_server("brewer")
p = figure()
p.patches([x2 for a in areas], list(areas.values()), color=colors, alpha=0.8, line_color=None)
show(p)
line_dash="dashed",
line_alpha=1.0,
)
ax_.renderers.append(hline)
title = Title()
title.text = make_label(var_name, selection)
ax_.title = title
ax_.xaxis.axis_label = "Total number of draws" if kind == "evolution" else "Quantile"
ax_.yaxis.axis_label = ylabel.format("Relative ESS" if relative else "ESS")
if backend_show(show):
grid = gridplot(ax.tolist(), toolbar_location="above")
bkp.show(grid)
return ax
x_key : str
The key in the serialized JSON object that contains the x-axis
value.
y_key : str
See `x_key`.
\*\*kwargs
Connection parameters passed to the `connect` function.
"""
subscriber, sequence, x, y = get_socket(x_key, y_key, **kwargs)
output_notebook()
fig = figure()
plot = fig.line(x, y)
handle = show(fig, notebook_handle=True)
push_notebook(handle=handle)
while True:
update(x_key, y_key, sequence, subscriber, plot)
push_notebook(handle=handle)
from bokeh.plotting import figure, output_file, show
# create a Figure object
p = figure(plot_width=300, plot_height=300, tools="pan,reset,save")
# add a Circle renderer to this figure
p.circle([1, 2.5, 3, 2], [2, 3, 1, 1.5], radius=0.3, alpha=0.5)
# specify how to output the plot(s)
output_file("foo.html")
# display the figure
show(p)
print df
for word, coeff in df.iterrows():
for n, c in enumerate(coeff):
if c > 0:
plot_sizes.append(c)
plot_topics.append(str(n))
plot_words.append(word)
if len(plot_sizes) == 0:
return
max_size = np.max(plot_sizes)
plot_sizes = [int(a/max_size * 75) + 25 for a in plot_sizes]
print plot_sizes, plot_words, plot_topics
p.circle(x=plot_topics, y=plot_words, size=plot_sizes, fill_alpha=0.6)
plt.show(p)
return plt.curplot()
def _ipython_display_(self, **kwargs):
show(self.figure)
self.display_notebook = True