Python plotly.graph_objs.Contour() Examples

The following are 4 code examples of plotly.graph_objs.Contour(). 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_objs , or try the search function .
Example #1
Source File: pycoQC_plot.py    From pycoQC with GNU General Public License v3.0 5 votes vote down vote up
def __2D_density_plot (self,
        x_field_name, y_field_name, x_lab, y_lab, x_scale, y_scale, x_nbins, y_nbins,
        colorscale, smooth_sigma, width, height, plot_title):
        """Private function generating density plots for all 2D distribution functions"""
        self.logger.info ("\t\tComputing plot")

        # Prepare all data
        lab1, dd1 = self.__2D_density_data ("all", x_field_name, y_field_name, x_nbins, y_nbins, x_scale, y_scale, smooth_sigma)
        lab2, dd2 = self.__2D_density_data ("pass", x_field_name, y_field_name, x_nbins, y_nbins, x_scale, y_scale, smooth_sigma)

        # Plot initial data
        data = [
            go.Contour (x=dd1["x"][0], y=dd1["y"][0], z=dd1["z"][0], contours=dd1["contours"][0],
                name="Density", hoverinfo="name+x+y", colorscale=colorscale, showlegend=True, connectgaps=True, line={"width":0}),
            go.Scatter (x=dd1["x"][1], y=dd1["y"][1],
                mode='markers', name='Median', hoverinfo="name+x+y", marker={"size":12,"color":'black', "symbol":"x"})]

        # Create update buttons
        updatemenus = [
            dict (type="buttons", active=0, x=-0.2, y=0, xanchor='left', yanchor='bottom', buttons = [
                dict (label=lab1, method='restyle', args=[dd1]),
                dict (label=lab2, method='restyle', args=[dd2])])]

        # tweak plot layout
        layout = go.Layout (
            hovermode = "closest",
            plot_bgcolor="whitesmoke",
            legend = {"x":-0.2, "y":1,"xanchor":'left',"yanchor":'top'},
            updatemenus = updatemenus,
            width = width,
            height = height,
            title = {"text":plot_title, "xref":"paper" ,"x":0.5, "xanchor":"center"},
            xaxis = {"title":x_lab, "showgrid":True, "zeroline":False, "showline":True, "type":x_scale},
            yaxis = {"title":y_lab, "showgrid":True, "zeroline":False, "showline":True, "type":y_scale})

        return go.Figure (data=data, layout=layout) 
Example #2
Source File: add_remove_points.py    From dash-regression with MIT License 5 votes vote down vote up
def func(custom_data_storage):
    data = json.loads(custom_data_storage)

    trace0 = go.Contour(
        x=np.linspace(0, 10, 200),
        y=np.linspace(0, 10, 200),
        z=np.ones(shape=(200, 200)),
        showscale=False,
        hoverinfo='none',
        contours=dict(coloring='lines'),
    )
    trace1 = go.Scatter(
        x=data['train_X'],
        y=data['train_y'],
        mode='markers',
        name='Training'
    )
    trace2 = go.Scatter(
        x=data['test_X'],
        y=data['test_y'],
        mode='markers',
        name='Training'
    )

    data = [trace0, trace1, trace2]
    figure = go.Figure(data=data)
    return figure 
Example #3
Source File: contour.py    From DataPlotly with GNU General Public License v2.0 5 votes vote down vote up
def name():
        return PlotType.tr('Contour Plot') 
Example #4
Source File: contour.py    From DataPlotly with GNU General Public License v2.0 5 votes vote down vote up
def create_trace(settings):
        return [graph_objs.Contour(
                z=[settings.x, settings.y],
                contours=dict(
                    coloring=settings.properties['cont_type'],
                    showlines=settings.properties['show_lines']
                ),
                colorscale=settings.properties['color_scale'],
                opacity=settings.properties['opacity']
            )]