本文整理汇总了Python中plotly.graph_objs.Scattergl方法的典型用法代码示例。如果您正苦于以下问题:Python graph_objs.Scattergl方法的具体用法?Python graph_objs.Scattergl怎么用?Python graph_objs.Scattergl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plotly.graph_objs
的用法示例。
在下文中一共展示了graph_objs.Scattergl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _draw_scatter
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def _draw_scatter(all_vocabs, all_freqs, output_prefix):
colors = [(s and t) and (s < t and s / t or t / s) or 0
for s, t in all_freqs]
colors = [c and np.log(c) or 0 for c in colors]
trace = go.Scattergl(
x=[s for s, t in all_freqs],
y=[t for s, t in all_freqs],
mode='markers',
text=all_vocabs,
marker=dict(color=colors, showscale=True, colorscale='Viridis'))
layout = go.Layout(
title='Scatter plot of shared tokens',
hovermode='closest',
xaxis=dict(title='src freq', type='log', autorange=True),
yaxis=dict(title='trg freq', type='log', autorange=True))
fig = go.Figure(data=[trace], layout=layout)
py.plot(
fig, filename='{}_scatter.html'.format(output_prefix), auto_open=False)
示例2: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
data = self.calc_convergence_metrics()
traces = []
for field in self.analysis_fieldsy:
x = data['generation']
y = data[field]
trace = go.Scattergl(x=x, y=y, name=field)
traces.append(trace)
total_distance = sum(data['Delta of Generational Distance'])
y_cumulative = []
for i in range(len(data['generation'])):
if i == 0:
y_acum = data['Delta of Generational Distance'][i]/total_distance *100
else:
y_acum += data['Delta of Generational Distance'][i]/total_distance *100
y_cumulative.append(y_acum)
x = data['generation']
trace = go.Scattergl(x=x, y=y_cumulative, yaxis='y2', name='Cumulative Generational Distance')
traces.append(trace)
return traces
开发者ID:architecture-building-systems,项目名称:CityEnergyAnalyst,代码行数:25,代码来源:f_paretocurve_convergence.py
示例3: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
# main data about technologies
data = self.process_individual_dispatch_curve_cooling()
graph = []
analysis_fields = self.remove_unused_fields(data, self.analysis_fields)
for field in analysis_fields:
y = (data[field].values) / 1E6 # into MW
trace = go.Bar(x=data.index, y=y, name=NAMING[field],
marker=dict(color=COLOR[field]))
graph.append(trace)
# data about demand
for field in self.analysis_field_demand:
y = (data[field].values) / 1E6 # into MW
trace = go.Scattergl(x=data.index, y=y, name=NAMING[field],
line=dict(width=1, color=COLOR[field]))
graph.append(trace)
return graph
开发者ID:architecture-building-systems,项目名称:CityEnergyAnalyst,代码行数:22,代码来源:f_dispatch_curve_cooling_plant.py
示例4: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
# main data about technologies
data = self.process_individual_dispatch_curve_heating()
graph = []
analysis_fields = self.remove_unused_fields(data, self.analysis_fields)
for field in analysis_fields:
y = (data[field].values) / 1E6 # into MW
trace = go.Bar(x=data.index, y=y, name=NAMING[field],
marker=dict(color=COLOR[field]))
graph.append(trace)
# data about demand
for field in self.analysis_field_demand:
y = (data[field].values) / 1E6 # into MW
trace = go.Scattergl(x=data.index, y=y, name=NAMING[field],
line=dict(width=1, color=COLOR[field]))
graph.append(trace)
return graph
开发者ID:architecture-building-systems,项目名称:CityEnergyAnalyst,代码行数:22,代码来源:e_dispatch_curve_heating_plant.py
示例5: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
traces = []
data_frame = self.plant_temperatures
analysis_fields = data_frame.columns
ambient_temp = self.ambient_temp
for field in analysis_fields:
y = data_frame[field].values
# sort by ambient temperature, needs some helper variables
y_old = np.vstack((np.array(ambient_temp.values.T), y))
y_new = np.vstack((np.array(ambient_temp.values.T), y))
y_new[0, :] = y_old[0, :][
y_old[0, :].argsort()] # y_old[0, :] is the ambient temperature which we are sorting by
y_new[1, :] = y_old[1, :][y_old[0, :].argsort()]
trace = go.Scattergl(x=y_new[0], y=y_new[1], name=NAMING[field],
marker=dict(color=COLOR[field]),
mode='markers')
traces.append(trace)
return traces
示例6: supply_return_ambient_temp_plot
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def supply_return_ambient_temp_plot(data_frame, data_frame_2, analysis_fields, title, output_path):
traces = []
for field in analysis_fields:
y = data_frame[field].values
# sort by ambient temperature, needs some helper variables
y_old = np.vstack((np.array(data_frame_2.values.T), y))
y_new = np.vstack((np.array(data_frame_2.values.T), y))
y_new[0, :] = y_old[0, :][
y_old[0, :].argsort()] # y_old[0, :] is the ambient temperature which we are sorting by
y_new[1, :] = y_old[1, :][y_old[0, :].argsort()]
trace = go.Scattergl(x=y_new[0], y=y_new[1], name=NAMING[field],
marker=dict(color=COLOR[field]),
mode='markers')
traces.append(trace)
# CREATE FIRST PAGE WITH TIMESERIES
layout = dict(images=LOGO, title=title, yaxis=dict(title='Temperature [deg C]'),
xaxis=dict(title='Ambient Temperature [deg C]'))
fig = dict(data=traces, layout=layout)
plot(fig, auto_open=False, filename=output_path)
return {'data': traces, 'layout': layout}
示例7: heating_reset_schedule
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def heating_reset_schedule(data_frame, analysis_fields, title, output_path):
# CREATE FIRST PAGE WITH TIMESERIES
traces = []
x = data_frame["T_ext_C"].values
data_frame = data_frame.replace(0, np.nan)
for field in analysis_fields:
y = data_frame[field].values
name = NAMING[field]
trace = go.Scattergl(x=x, y=y, name=name, mode='markers',
marker=dict(color=COLOR[field]))
traces.append(trace)
layout = go.Layout(images=LOGO, title=title,
xaxis=dict(title='Outdoor Temperature [C]'),
yaxis=dict(title='HVAC System Temperature [C]'))
fig = go.Figure(data=traces, layout=layout)
plot(fig, auto_open=False, filename=output_path)
return {'data': traces, 'layout': layout}
示例8: create_relative_humidity_lines
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def create_relative_humidity_lines():
"""
calculates curves of constant relative humidity for plotting (10% - 100% in steps of 10%)
:return: list of plotly table trace
:rtype: list of plotly.graph_objs.Scatter
"""
traces = []
# draw lines of constant relative humidity for psychrometric chart
rh_lines = np.linspace(0.1, 1, 10) # lines from 10% to 100%
t_axis = np.linspace(-5, 45, 50)
P_ATM = 101325 # Pa, standard atmospheric pressure at sea level
for rh_line in rh_lines:
y_data = calc_constant_rh_curve(t_axis, rh_line, P_ATM)
trace = go.Scattergl(x=t_axis, y=y_data, mode='lines', name="{:.0%} relative humidity".format(rh_line),
line=dict(color=COLORS_TO_RGB['grey_light'], width=1), showlegend=False)
traces.append(trace)
return traces
示例9: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
data = self.calculate_hourly_loads()
traces = []
analysis_fields = self.remove_unused_fields(data, self.analysis_fields)
for field in analysis_fields:
y = data[field].values / 1E3 # to MW
name = NAMING[field]
trace = go.Bar(x=data.index, y=y, name=name, marker=dict(color=COLOR[field]))
traces.append(trace)
data_T = self.calculate_external_temperature()
for field in ["T_ext_C"]:
y = data_T[field].values
name = NAMING[field]
trace = go.Scattergl(x=data_T.index, y=y, name=name, yaxis='y2', opacity=0.2)
traces.append(trace)
return traces
示例10: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
graph = []
# This includes the point of today's emissions
data_today = self.process_today_system_performance()
data_today = self.normalize_data(data_today, self.normalization, self.objectives)
xs = data_today[self.objectives[0]].values
ys = data_today[self.objectives[1]].values
name = "Today"
trace = go.Scattergl(x=xs, y=ys, mode='markers', name="Today's system", text=name,
marker=dict(size=18, color='black', line=dict(color='black',width=2)))
graph.append(trace)
# PUT THE PARETO CURVE INSIDE
data = self.process_generation_total_performance_pareto_with_multi()
data = self.normalize_data(data, self.normalization, self.objectives)
xs = data[self.objectives[0]].values
ys = data[self.objectives[1]].values
zs = data[self.objectives[2]].values
individual_names = data['individual_name'].values
trace = go.Scattergl(x=xs, y=ys, mode='markers', name='Pareto optimal systems', text=individual_names,
marker=dict(size=18, color=zs,
colorbar=go.ColorBar(title=self.titlez, titleside='bottom'),
colorscale='Jet', showscale=True, opacity=0.8))
graph.append(trace)
# This includes the points of the multicriteria assessment in here
final_dataframe = calc_final_dataframe(data)
xs = final_dataframe[self.objectives[0]].values
ys = final_dataframe[self.objectives[1]].values
name = final_dataframe["Attribute"].values
trace = go.Scattergl(x=xs, y=ys, mode='markers', name="Multi-criteria system", text=name,
marker=dict(size=18, color='white', line=dict(
color='black',
width=2)))
graph.append(trace)
return graph
示例11: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
# main data about technologies
data = self.process_individual_dispatch_curve_electricity()
graph = []
analysis_fields = self.remove_unused_fields(data, self.analysis_fields)
for field in analysis_fields:
y = (data[field].values) / 1E6 # into MWh
trace = go.Bar(x=data.index, y=y, name=NAMING[field],
marker=dict(color=COLOR[field]))
graph.append(trace)
# data about demand
data_req = self.process_individual_requirements_curve_electricity()
for field in self.analysis_field_demand:
y = (data_req[field].values) / 1E6 # into MWh
trace = go.Scattergl(x=data.index, y=y, name=NAMING[field],
line=dict(width=1, color=COLOR[field]))
graph.append(trace)
# data about exports
analysis_fields_exports = self.remove_unused_fields(data, self.analysis_fields_exports)
for field in analysis_fields_exports:
y = (data[field].values) / 1E6 # into MWh
trace = go.Bar(x=data.index, y=y, name=NAMING[field],
marker=dict(color=COLOR[field]))
graph.append(trace)
return graph
开发者ID:architecture-building-systems,项目名称:CityEnergyAnalyst,代码行数:32,代码来源:d_dispatch_curve_electricity.py
示例12: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
analysis_fields = ["P_loss_kWh"] # data to plot
data_frame = self.plant_pumping_requirement_kWh
data_frame.columns = analysis_fields
graph = []
duration = range(HOURS_IN_YEAR)
x = [(a - min(duration)) / (max(duration) - min(duration)) * 100 for a in duration] # calculate relative values
for field in analysis_fields:
data_frame = data_frame.sort_values(by=field, ascending=False)
y = data_frame[field].values
trace = go.Scattergl(x=x, y=y, name=field, fill='tozeroy', opacity=0.8,
marker=dict(color=COLOR[field]))
graph.append(trace)
return graph
示例13: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
data_frame = self.calc_data_frame()
traces = []
x = data_frame.index
for field in data_frame.columns:
y = data_frame[field].values
name = NAMING[field]
trace = go.Scattergl(x=x, y=y, name=name,
marker=dict(color=COLOR[field]))
traces.append(trace)
return traces
示例14: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
traces = []
data = self.data
x = data["T_ext_C"].values
data = data.replace(0, np.nan)
for field in self.analysis_fields:
y = data[field].values
name = NAMING[field]
trace = go.Scattergl(x=x, y=y, name=name, mode='markers', marker=dict(color=COLOR[field]))
traces.append(trace)
return traces
示例15: calc_graph
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scattergl [as 别名]
def calc_graph(self):
graph = []
duration = range(HOURS_IN_YEAR)
x = [(a - min(duration)) / (max(duration) - min(duration)) * 100 for a in duration]
self.analysis_fields = self.remove_unused_fields(self.data, self.analysis_fields)
for field in self.analysis_fields:
name = NAMING[field]
y = self.data.sort_values(by=field, ascending=False)[field].values
trace = go.Scattergl(x=x, y=y, name=name, fill='tozeroy', opacity=0.8,
marker=dict(color=COLOR[field]))
graph.append(trace)
return graph