Black Lives Matter. Please consider donating to Black Girls Code today.

Using two markers at Scatterplot Matrix in Python

Hello. I am trying to use two types of markers at a scatterplot matrix. Like for example, using contour line for the boxes on the lower left hand side of the matrix, and scatter plot for that on the upper hand side of the matrix as shown below.

Is there a way to do this with Plotly?

Yes, you can create such a matrix of Plotly plots, as follows:

 fig= plotly.tools.make_subplots(rows=3,
                                 cols=3,
                                 horizontal_spacing=0.02, #choose appropriately the h and v gaps
                                 vertical_spacing=0.02,
                                 )

For each type of Plotly plot (Scatter, Histogram, Contour ) define a function that returns the corresponding Plotly object.
For example such a function returns a contour plot:

def make_contour(x, y, z, colorscale):
    return  Contour( x=x,
                     y=y,
                     z=z,
                     colorscale=colorscale, #set reversescale=True if needed  
                     contours=Contours(showlines=True),                         
                     line=dict(width=0.5, color='rgb(15,15,15)'),     
                     name='',
                     showscale=False    
                   )

A Plotly graph object returned by one of these three functions is then assigned to the corresponding cell in the matrix of subplots:

fig.append_trace(make_contour(x_data, y_data, z_data, 'Viridis'), 2, 1) # (2,1) is the row 2, column 1 cell

Finally you can update the layout according to your preferences:

fig['layout'].update(
                    showlegend=False,     
                    hovermode='closest',  
                    autosize=False,       
                    width=800,       
                    height=800,
                    title='your title'                  
                    )