0

I have 2 plotly subplots, a surface plot and table plot. By default table plots have columns which you can drag and move, I want to disable this feature, I have found the command

config = {'staticPlot': True} 
fig.show(config=config) 

works but this also affects the surface plot which doesn't display properly. how do I set this config only on the table subplot? Also is there a way the table can behave like regular html text where i can select and copy values? Right now it is like an image i cannot select a cell. Thank you

fig = make_subplots(
rows=2, cols=1,
row_heights=[0.9, 0.5],
vertical_spacing=0.03,
specs=[[{"type": "surface"}],
       [{"type": "table"}]])


fig_table = go.Table(
    header=dict(
        values=[""] + desired_x_axis,
        font=dict(size=12),
        align="left"
    ),
    cells=dict(
        font=dict(size=11),
        values=z_values,
        align = "left",
        fill=dict(color=['#ced9e4','#F0F8FF']))
    
        
)

config = {'staticPlot': True} 
fig.show(config=config) 

1 Answer 1

1

I have been looking for a Plotly funcionality to easily disable this drag-and-drop behavior for a while and I did not find anything. One simply way to achieve it -only for the first table, extendible for others- is to add this JavaScript line to the code (I use the argument include_plotlyjs of the function fig.to_html(), but there should be other ways):

document.getElementsByClassName("table")[0].style.pointerEvents = "none";

With this is not needed to include {'staticPlot': True}.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.