Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Secondary Gridlines

Hello,
I am taking a stab at creating major and minor gridlines. My thought was to:

  • add dummy data to “xaxis2”
  • style "xaxis"2 with different color and different tick attributes
  • hide/erase the dummy data

As you can see in the plot below, the dummy data and the secondary axis are plotting but not
the ticks or the grid. Why is that?

fig = go.Figure(layout = layout)
for item, lineColor in zip(cpt_list,plotly.colors.qualitative.G10):

    fig.add_trace(go.Scatter(
                                x = df_CPT_ALL.loc[item,parameter.value],
                                y = df_CPT_ALL.loc[item,'Elevation'],
                                name = item,
                                line_color=  lineColor,
                                mode = plotMapper[parameter.value][-1],
                                marker_symbol = "circle",
                                marker_size = 6,
                                line_width = 2))

fig.add_trace(go.Scatter(
    x=[40],
    y=[0],
    xaxis="x2"
))   

fig.update_layout(xaxis=dict(   range = plotMapper[parameter.value][:2],
                                tickmode = 'linear',
                                tick0 = 25,
                                dtick = 5,
                                #tickmode = 'array',
                                #tickvals = xtickvals,
                                #ticktext = xticktext,
                                title = plotMapper[parameter.value][4]),
                  yaxis=dict(   range = [-40,45],
                                tickmode = 'linear',
                                tick0 = -40,
                                dtick = 5,
                                title = 'Elevation (ft)'),
                  xaxis2=dict(  overlaying = 'x',
                                tickmode = 'linear',
                                tick0 = 27.5,
                                dtick = 5,
                                side = 'top',
                                title = 'Second Axis',
                                showgrid=True,
                                gridcolor = '#D3D3D3',))