Python plotly.graph_objects.Scatter() Examples

The following are 30 code examples of plotly.graph_objects.Scatter(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module plotly.graph_objects , or try the search function .
Example #1
Source File: accessors.py    From vectorbt with GNU General Public License v3.0 6 votes vote down vote up
def plot(self, trace_kwargs={}, fig=None, **layout_kwargs):
        """Plot each column in DataFrame as a line.

        Args:
            trace_kwargs (dict or list of dict): Keyword arguments passed to each `plotly.graph_objects.Scatter`.
            fig (plotly.graph_objects.Figure): Figure to add traces to.
            **layout_kwargs: Keyword arguments for layout.
        Example:
            ```py
            df[['a', 'b']].vbt.tseries.plot()
            ```

            ![](/vectorbt/docs/img/tseries_df_plot.png)"""

        for col in range(self._obj.shape[1]):
            fig = self._obj.iloc[:, col].vbt.tseries.plot(
                trace_kwargs=trace_kwargs,
                fig=fig,
                **layout_kwargs
            )

        return fig 
Example #2
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_powerline_txt(self, name,
                            pos_or_x, pos_or_y,
                            pos_ex_x, pos_ex_y,
                            text):
        mid_x = (pos_or_x + pos_ex_x) / 2
        mid_y = (pos_or_y + pos_ex_y) / 2
        dir_x = pos_ex_x - pos_or_x
        dir_y = pos_ex_y - pos_or_y
        orth_x = -dir_y
        orth_y = dir_x
        orth_norm = np.linalg.norm([orth_x, orth_y])
        txt_x = mid_x + (orth_x / orth_norm) * 2
        txt_y = mid_y + (orth_y / orth_norm) * 2
        text_pos = self._textpos_from_dir(orth_x, orth_y)

        txt_trace = go.Scatter(x=[txt_x], y=[txt_y],
                               text=[text],
                               name=name,
                               mode="text",
                               textposition=text_pos,
                               showlegend=False)
        return txt_trace 
Example #3
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_gen_circle(self, pos_x, pos_y, name, text):
        marker_dict = dict(
            size = self._gen_radius,
            color=self._gen_fill_color,
            showscale = False,
            line=dict(
                width=self._gen_line_width,
                color=self._gen_line_color
            )
        )
        return go.Scatter(x=[pos_x], y=[pos_y],
                          mode="markers",
                          text=[text],
                          name=self._gen_prefix + name,
                          marker=marker_dict,
                          showlegend=False) 
Example #4
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_load_circle(self, pos_x, pos_y, name, text):
        marker_dict = dict(
            size = self._load_radius,
            color=self._load_fill_color,
            showscale = False,
            line=dict(
                width=self._load_line_width,
                color=self._load_line_color
            )
        )
        return go.Scatter(x=[pos_x], y=[pos_y],
                          mode="markers",
                          text=[text],
                          name=self._load_prefix + name,
                          marker=marker_dict,
                          showlegend=False) 
Example #5
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_substation_circle(self, name, pos_x, pos_y):
        marker_dict = dict(
            size = self._sub_radius,
            color=self._sub_fill_color,
            showscale = False,
            line=dict(
                width=self._sub_line_width,
                color=self._sub_line_color
            )
        )
        return go.Scatter(x=[pos_x], y=[pos_y],
                          mode="markers",
                          text=[name],
                          name=self._sub_prefix + name,
                          marker=marker_dict,
                          showlegend=False) 
Example #6
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_loads_one_load(self, fig, l_id, pos_load, txt_, pos_end_line, pos_load_sub, how_center, this_col):
        # add the MW load
        trace = go.Scatter(x=[pos_load.real],
                           y=[pos_load.imag],
                           text=[txt_],
                           mode="text",
                           showlegend=False,
                           textfont=dict(
                               color=this_col
                           ))
        # add the line between the MW display and the substation
        # TODO later one, add something that looks like a load, a house for example
        res = go.layout.Shape(
            type="line",
            xref="x",
            yref="y",
            x0=pos_end_line.real,
            y0=pos_end_line.imag,
            x1=pos_load_sub[0],
            y1=pos_load_sub[1],
            layer="below",
            line=dict(color=this_col
            )
        )
        return res, trace 
Example #7
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_loads_one_load(self, fig, l_id, pos_load, txt_, pos_end_line, pos_load_sub, how_center, this_col):
        # add the MW load
        trace = go.Scatter(x=[pos_load.real],
                           y=[pos_load.imag],
                           text=[txt_],
                           mode="text",
                           showlegend=False,
                           textfont=dict(
                               color=this_col
                           ))
        # add the line between the MW display and the substation
        # TODO later one, add something that looks like a load, a house for example
        res = go.layout.Shape(
            type="line",
            xref="x",
            yref="y",
            x0=pos_end_line.real,
            y0=pos_end_line.imag,
            x1=pos_load_sub[0],
            y1=pos_load_sub[1],
            layer="below",
            line=dict(color=this_col
            )
        )
        return res, trace 
Example #8
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_powerline_txt(self, name,
                            pos_or_x, pos_or_y,
                            pos_ex_x, pos_ex_y,
                            text):
        mid_x = (pos_or_x + pos_ex_x) / 2
        mid_y = (pos_or_y + pos_ex_y) / 2
        dir_x = pos_ex_x - pos_or_x
        dir_y = pos_ex_y - pos_or_y
        orth_x = -dir_y
        orth_y = dir_x
        orth_norm = np.linalg.norm([orth_x, orth_y])
        txt_x = mid_x + (orth_x / orth_norm) * 2
        txt_y = mid_y + (orth_y / orth_norm) * 2
        text_pos = self._textpos_from_dir(orth_x, orth_y)

        txt_trace = go.Scatter(x=[txt_x], y=[txt_y],
                               text=[text],
                               name=name,
                               mode="text",
                               textposition=text_pos,
                               showlegend=False)
        return txt_trace 
Example #9
Source File: accessors.py    From vectorbt with GNU General Public License v3.0 6 votes vote down vote up
def plot(self, trace_kwargs={}, fig=None, **layout_kwargs):
        """Plot each column in DataFrame as a line.

        Args:
            trace_kwargs (dict or list of dict): Keyword arguments passed to each `plotly.graph_objects.Scatter`.
            fig (plotly.graph_objects.Figure): Figure to add traces to.
            **layout_kwargs: Keyword arguments for layout.
        Example:
            ```py
            signals[['a', 'c']].vbt.signals.plot().show_png()
            ```

            ![](/vectorbt/docs/img/signals_signals_plot.png)"""
        for col in range(self._obj.shape[1]):
            fig = self._obj.iloc[:, col].vbt.signals.plot(
                trace_kwargs=trace_kwargs,
                fig=fig,
                **layout_kwargs
            )

        return fig 
Example #10
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_gen_circle(self, pos_x, pos_y, name, text):
        marker_dict = dict(
            size = self._gen_radius,
            color=self._gen_fill_color,
            showscale = False,
            line=dict(
                width=self._gen_line_width,
                color=self._gen_line_color
            )
        )
        return go.Scatter(x=[pos_x], y=[pos_y],
                          mode="markers",
                          text=[text],
                          name=self._gen_prefix + name,
                          marker=marker_dict,
                          showlegend=False) 
Example #11
Source File: view.py    From flaskerize with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def make_chart(title):
    import json

    import plotly.graph_objects as go
    import plotly

    layout = go.Layout(title=title)

    data = go.Scatter(
        x=[1, 2, 3, 4],
        y=[10, 11, 12, 13],
        mode="markers",
        marker=dict(size=[40, 60, 80, 100], color=[0, 1, 2, 3]),
    )

    fig = go.Figure(data=data)
    fig = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    layout = json.dumps(layout, cls=plotly.utils.PlotlyJSONEncoder)
    return fig, layout 
Example #12
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_load_circle(self, pos_x, pos_y, name, text):
        marker_dict = dict(
            size = self._load_radius,
            color=self._load_fill_color,
            showscale = False,
            line=dict(
                width=self._load_line_width,
                color=self._load_line_color
            )
        )
        return go.Scatter(x=[pos_x], y=[pos_y],
                          mode="markers",
                          text=[text],
                          name=self._load_prefix + name,
                          marker=marker_dict,
                          showlegend=False) 
Example #13
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 6 votes vote down vote up
def _draw_substation_circle(self, name, pos_x, pos_y):
        marker_dict = dict(
            size = self._sub_radius,
            color=self._sub_fill_color,
            showscale = False,
            line=dict(
                width=self._sub_line_width,
                color=self._sub_line_color
            )
        )
        return go.Scatter(x=[pos_x], y=[pos_y],
                          mode="markers",
                          text=[name],
                          name=self._sub_prefix + name,
                          marker=marker_dict,
                          showlegend=False) 
Example #14
Source File: basic.py    From vectorbt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, x_labels, trace_names=None, data=None, trace_kwargs={}, **layout_kwargs):
        """Create an updatable scatter plot.

        Args:
            x_labels (list of str): X-axis labels, corresponding to index in pandas.
            trace_names (str or list of str): Trace names, corresponding to columns in pandas.
            data (array_like): Data in any format that can be converted to NumPy.
            trace_kwargs (dict or list of dict): Keyword arguments passed to each `plotly.graph_objects.Scatter`.
            **layout_kwargs: Keyword arguments for layout.
        Example:
            ```py
            vbt.Scatter(['x', 'y'], trace_names=['a', 'b'], data=[[1, 2], [3, 4]])
            ```
            ![](/vectorbt/docs/img/Scatter.png)
            """

        if isinstance(trace_names, str) or trace_names is None:
            trace_names = [trace_names]
        self._x_labels = x_labels
        self._trace_names = trace_names

        super().__init__()
        self.update_layout(**layout_kwargs)

        # Add traces
        for i, trace_name in enumerate(trace_names):
            scatter = go.Scatter(
                x=x_labels,
                name=trace_name,
                showlegend=trace_name is not None
            )
            scatter.update(**(trace_kwargs[i] if isinstance(trace_kwargs, (list, tuple)) else trace_kwargs))
            self.add_trace(scatter)

        if data is not None:
            self.update_data(data) 
Example #15
Source File: accessors.py    From vectorbt with GNU General Public License v3.0 5 votes vote down vote up
def plot(self, name=None, trace_kwargs={}, fig=None, **layout_kwargs):
        """Plot Series as a line.

        Args:
            name (str): Name of the signals.
            trace_kwargs (dict): Keyword arguments passed to `plotly.graph_objects.Scatter`.
            fig (plotly.graph_objects.Figure): Figure to add traces to.
            **layout_kwargs: Keyword arguments for layout.
        Example:
            ```py
            signals['a'].vbt.signals.plot()
            ```

            ![](/vectorbt/docs/img/signals_sr_plot.png)"""
        # Set up figure
        if fig is None:
            fig = DefaultFigureWidget()
        fig.update_layout(
            yaxis=dict(
                tickmode='array',
                tickvals=[0, 1],
                ticktext=['false', 'true']
            )
        )
        fig.update_layout(**layout_kwargs)
        if name is None:
            name = self._obj.name

        scatter = go.Scatter(
            x=self.index,
            y=self._obj.values,
            mode='lines',
            name=str(name),
            showlegend=name is not None
        )
        scatter.update(**trace_kwargs)
        fig.add_trace(scatter)

        return fig 
Example #16
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 5 votes vote down vote up
def _draw_powerline_bus(self, pos_x, pos_y, dir_x, dir_y, bus, line_name, side_prefix):
        marker_dict = dict(
            size = self._line_bus_radius,
            color = self._line_bus_colors[bus],
            showscale = False
        )
        center_x = pos_x + dir_x * (self._sub_radius - self._line_bus_radius)
        center_y = pos_y + dir_y * (self._sub_radius - self._line_bus_radius)
        trace_name = self._line_prefix + self._bus_prefix + side_prefix + line_name
        return go.Scatter(x=[center_x], y=[center_y],
                          marker=marker_dict,
                          name=trace_name,
                          hoverinfo='skip',
                          showlegend=False) 
Example #17
Source File: accessors.py    From vectorbt with GNU General Public License v3.0 5 votes vote down vote up
def plot(self, name=None, trace_kwargs={}, fig=None, **layout_kwargs):
        """Plot Series as a line.

        Args:
            name (str): Name of the time series.
            trace_kwargs (dict): Keyword arguments passed to `plotly.graph_objects.Scatter`.
            fig (plotly.graph_objects.Figure): Figure to add traces to.
            **layout_kwargs: Keyword arguments for layout.
        Example:
            ```py
            df['a'].vbt.tseries.plot()
            ```

            ![](/vectorbt/docs/img/tseries_sr_plot.png)"""
        if fig is None:
            fig = DefaultFigureWidget()
        fig.update_layout(**layout_kwargs)
        if name is None:
            name = self._obj.name

        scatter = go.Scatter(
            x=self.index,
            y=self._obj.values,
            mode='lines',
            name=str(name),
            showlegend=name is not None
        )
        scatter.update(**trace_kwargs)
        fig.add_trace(scatter)

        return fig 
Example #18
Source File: distributed_logger.py    From rl_algorithms with MIT License 5 votes vote down vote up
def write_worker_log(self, worker_logs: List[dict]):
        """Log the mean scores of each episode per update step to wandb."""
        # NOTE: Worker plots are passed onto wandb.log as matplotlib.pyplot
        #       since wandb doesn't support logging multiple lines to single plot
        if self.args.log:
            self.set_wandb()
            # Plot individual workers
            fig = go.Figure()
            worker_id = 0
            for worker_log in worker_logs:
                fig.add_trace(
                    go.Scatter(
                        x=list(worker_log.keys()),
                        y=smoothen_graph(list(worker_log.values())),
                        mode="lines",
                        name=f"Worker {worker_id}",
                        line=dict(width=2),
                    )
                )
                worker_id = worker_id + 1

            # Plot mean scores
            steps = worker_logs[0].keys()
            mean_scores = []
            for step in steps:
                each_scores = [worker_log[step] for worker_log in worker_logs]
                mean_scores.append(np.mean(each_scores))

            fig.add_trace(
                go.Scatter(
                    x=list(worker_logs[0].keys()),
                    y=mean_scores,
                    mode="lines+markers",
                    name="Mean scores",
                    line=dict(width=5),
                )
            )

            # Write to wandb
            wandb.log({"Worker scores": fig}) 
Example #19
Source File: cacheGraph.py    From nanoBench with GNU Affero General Public License v3.0 5 votes vote down vote up
def getPlotlyGraphDiv(title, x_title, y_title, traces):
   fig = go.Figure()
   fig.update_layout(title_text=title)
   fig.update_xaxes(title_text=x_title)
   fig.update_yaxes(title_text=y_title)

   for name, y_values in traces:
      fig.add_trace(go.Scatter(y=y_values, mode='lines+markers', name=name))

   return plot(fig, include_plotlyjs=False, output_type='div') 
Example #20
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 5 votes vote down vote up
def _draw_powerlines_one_powerline(self, fig, l_id, pos_or, pos_ex, status, value, txt_, or_to_ex, this_col):
        """
        Draw the powerline, between two substations.

        Parameters
        ----------
        observation
        fig

        Returns
        -------

        """
        tmp = draw_line(pos_or,
                        pos_ex,
                        rho=value,
                        color_palette=self.cols,
                        status=status,
                        line_color=this_col
                        )
        trace = go.Scatter(x=[(pos_or[0] + pos_ex[0]) / 2],
                           y=[(pos_or[1] + pos_ex[1]) / 2],
                           text=[txt_],
                           mode="text",
                           showlegend=False,
                           textfont=dict(
                               color=this_col
                           ))
        return tmp, trace 
Example #21
Source File: parkDataVisulization.py    From python-urbanPlanning with MIT License 5 votes vote down vote up
def LinePlot_facility(df):
    # print(df.columns)
    '''
    Index(['park_no_left', 'label', 'park_class', 'location', 'acres',
       'shape_area', 'shape_leng', 'perimeter', 'geometry', 'index_right',
       'facility_n', 'facility_t', 'park', 'park_no_right', 'x_coord',
       'y_coord'],
      dtype='object')
    '''
    facilityLabelFre=df.facility_n.value_counts()
    print(facilityLabelFre.index)
    print(len(facilityLabelFre.index))
    
    #Create traces
    fig = go.Figure()
    fig.add_trace(go.Scatter(x=facilityLabelFre.index, y=facilityLabelFre, mode='lines+markers',name='lines+markers',
                             line=dict(color='firebrick', width=1),marker_size=7
                             ))   
    fig.update_layout(
    title_text=" ",
    font=dict(
            family='SimHei', #'Times New Roman'
            size=12,
           # color="#7f7f7f"
         ),
    plot_bgcolor='rgb(240, 240, 240)',
    )    
    fig.show()

#散点分布图_地表覆盖 
Example #22
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 5 votes vote down vote up
def _draw_subs_one_sub(self, fig, sub_id, center, this_col, txt_):
        trace = go.Scatter(x=[center[0]],
                           y=[center[1]],
                           text=[txt_],
                           mode="text",
                           showlegend=False,
                           textfont=dict(
                               color=this_col
                           ))
        res = draw_sub(center, radius=self.radius_sub, line_color=this_col)
        return res, trace 
Example #23
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 5 votes vote down vote up
def _draw_powerline_arrow(self,
                              pos_or_x, pos_or_y,
                              pos_ex_x, pos_ex_y,
                              watts_value,
                              line_name,
                              line_color):
        cx, cy = pltu.middle_from_points(pos_or_x, pos_or_y, pos_ex_x,  pos_ex_y)
        dx, dy = pltu.norm_from_points(pos_or_x, pos_or_y, pos_ex_x,  pos_ex_y)
        sym = self._plotly_tri_from_line_dir_and_sign(dx, dy, watts_value)
        marker_dict = dict(
            size = self._line_arrow_radius,
            color = line_color,
            showscale = False,
            symbol=sym
        )

        sub_offx = dx * self._sub_radius
        sub_offy = dy * self._sub_radius
        or_offx = dx * self._line_arrow_len
        or_offy = dy * self._line_arrow_len
        arrx_or = pos_or_x + sub_offx + or_offx
        arrx_ex = pos_or_x + sub_offx
        arry_or = pos_or_y + sub_offy + or_offy
        arry_ex = pos_or_y + sub_offy
        trace_name = self._line_prefix + self._arrow_prefix + line_name
        return go.Scatter(x=[arrx_or, arrx_ex],
                          y=[arry_or, arry_ex],
                          hoverinfo='skip',
                          showlegend=False,
                          marker=marker_dict,
                          name=trace_name) 
Example #24
Source File: plotly_stock_chart.py    From tensortrade with Apache License 2.0 5 votes vote down vote up
def _create_figure(self, performance_keys):
        fig = make_subplots(
            rows=4, cols=1, shared_xaxes=True, vertical_spacing=0.03,
            row_heights=[0.55, 0.15, 0.15, 0.15],
        )
        fig.add_trace(go.Candlestick(name='Price', xaxis='x1', yaxis='y1',
                                     showlegend=False), row=1, col=1)
        fig.update_layout(xaxis_rangeslider_visible=False)

        fig.add_trace(go.Bar(name='Volume', showlegend=False,
                             marker={'color': 'DodgerBlue'}),
                      row=2, col=1)

        for k in performance_keys:
            fig.add_trace(go.Scatter(mode='lines', name=k), row=3, col=1)

        fig.add_trace(go.Scatter(mode='lines', name='Net Worth', marker={ 'color': 'DarkGreen' }),
                      row=4, col=1)

        fig.update_xaxes(linecolor='Grey', gridcolor='Gainsboro')
        fig.update_yaxes(linecolor='Grey', gridcolor='Gainsboro')
        fig.update_xaxes(title_text='Price', row=1)
        fig.update_xaxes(title_text='Volume', row=2)
        fig.update_xaxes(title_text='Performance', row=3)
        fig.update_xaxes(title_text='Net Worth', row=4)
        fig.update_xaxes(title_standoff=7, title_font=dict(size=12))

        self.fig = go.FigureWidget(fig)
        self._price_chart = self.fig.data[0]
        self._volume_chart = self.fig.data[1]
        self._performance_chart = self.fig.data[2]
        self._net_worth_chart = self.fig.data[-1]

        self.fig.update_annotations({'font': {'size': 12}})
        self.fig.update_layout(template='plotly_white', height=self._height, margin=dict(t=50))
        self._base_annotations = self.fig.layout.annotations 
Example #25
Source File: topic_flow_viewer.py    From TopicNet with MIT License 5 votes vote down vote up
def plot(self, topics, significance_threshold=1e-2):
        """
        Function for plotly graph building.

        Parameters
        ----------
        topics : list of int
            topics that need to be visualized
        significance_threshold : float
            plot ignores values lower than threshold
        """
        fig = go.Figure()

        for t in topics:
            fig.add_trace(go.Scatter(x=np.arange(len(self.unique_time_labels)),
                                     y=[
                                         value if value > significance_threshold
                                         else None
                                         for value in self.topic_values[t, :]
                                     ],
                                     text=self.topic_tokens_str[f'topic_{t}'],
                                     hoverinfo='text',
                                     mode=None,
                                     hoveron='points+fills',
                                     fill='tozeroy',
                                     name=f'topic_{t}'))

        fig.update_layout(
            title='Trending Topics Over Time',
            title_font_size=30,
            autosize=True,
            paper_bgcolor='LightSteelBlue'
        )

        fig.update_xaxes(title_text='Time',
                         tickvals=np.arange(len(self.unique_time_labels))[::4],
                         ticktext=self.unique_time_labels[::4])
        fig.update_yaxes(title_text='Value')
        fig.show() 
Example #26
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 5 votes vote down vote up
def _draw_gen_line(self, pos_x, pos_y, sub_x, sub_y):
        style_line=dict(
            color="black",
            width=self._gen_line_width
        )

        line_trace = go.Scatter(x=[pos_x, sub_x],
                                y=[pos_y, sub_y],
                                hoverinfo='skip',
                                line=style_line,
                                showlegend=False)
        return line_trace 
Example #27
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 5 votes vote down vote up
def _draw_substation_txt(self, name, pos_x, pos_y, text):
        return go.Scatter(x=[pos_x], y=[pos_y],
                          text=[text], mode="text",
                          name=name,
                          textposition="middle center",
                          hoverinfo='skip',
                          showlegend=False) 
Example #28
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 5 votes vote down vote up
def _draw_load_txt(self, name, pos_x, pos_y, text, textpos):
        return go.Scatter(x=[pos_x], y=[pos_y],
                          text=[text], mode="text",
                          name=name,
                          hoverinfo='skip',
                          textposition=textpos,
                          showlegend=False) 
Example #29
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 5 votes vote down vote up
def _draw_load_line(self, pos_x, pos_y, sub_x, sub_y):
        style_line=dict(
            color="black",
            width=self._load_line_width)

        line_trace = go.Scatter(x=[pos_x, sub_x],
                                y=[pos_y, sub_y],
                                hoverinfo='skip',
                                line=style_line,
                                showlegend=False)
        return line_trace 
Example #30
Source File: PlotPlotly.py    From Grid2Op with Mozilla Public License 2.0 5 votes vote down vote up
def _draw_gen_txt(self, name, pos_x, pos_y, text, text_pos):
        return go.Scatter(x=[pos_x], y=[pos_y],
                          text=[text], name=name,
                          mode="text",
                          hoverinfo='skip',
                          textposition=text_pos,
                          showlegend=False)