3D surface plot grids

Hi,

Is it possible to show the grid lines on a 3D surface plot in Plotly via Python? Also, is it possible to display the numbers on the various axes or legend in full instead of M or B for million or billion? Thanks very much!

@angel You cannot plot the grid lines on the surface via a destinated option in the surface trace definition. Eventually you can code their computation and plot them as scatter3d, mode='lines'.

To display the ticklabels as full (integer) numbers or as decimal numbers you should set the tickformat in the definition of layout['xaxis'], layout['yaxis'], and layout['zaxis']:

tickformat='d' for integers or tickformat='.3f' for floats.
as well as hoverformat='d' or hoverformat='.3f' if you want to be displayed in the same format on hover.

1 Like

@empet Thank you so much for this!

Hi, It’s possible to show in the tickformat like 30.000? But I got this.

image

@vitorsc23 You get large integers displayed in french-style, as follows:

fig = go.Figure([go.Scatter(x=[1,2,3,4], 
                          y=[200000,600000,400000,800000],
                          name='my_plot',
                          showlegend=True)
                         ])
fig.update_layout(yaxis_tickformat=',d',
                  separators=',.')

Thanks @empet 1 - It’s possible to do it on tables as wel ?
image
Something like 30.381, 30.935

2 - Can I put some border like this one ?

image

3 - I can put some shadown, degrade effect on trace. Something subtle and beautiful.

Thanks a lot

@vitorsc23 Yes, you can set the cell format in the same way:

import plotly.graph_objects as go

prods = ['Aaaa', 'Bbbb', 'Cccc', 'Dddd', 'Eeee', 'Ffff']
vals = [100000, 200000, 1500000, 30000, 170150, 2300000]
font_color = ['rgb(40,40,40)', ['rgb(255,0,0)' if v <= 0 else 'rgb(10,10,10)' for v in vals]]

table_trace = go.Table(
                 columnwidth= [15]+[15],
                 columnorder=[0, 1],
                 header = dict(height = 50,
                               values = [['<b>Product</b>'], ['<b>Quantity</b>']],
                               line = dict(color='rgb(50,50,50)'),
                               align = ['left']*2,
                               font = dict(color=['rgb(45,45,45)']*2, size=14),
                             
                              ),
                 cells = dict(values = [prods, vals],
                              line = dict(color='#506784'),
                              align = ['left']*5,
                              
                              font = dict(family="Arial", size=14, color=font_color),
                              format = [None, ",d"],
                              height = 30,
                              fill = dict(color='rgb(245,245,245)'))
                             )
                 

layout = go.Layout(width=400, height=415, autosize=False, 
              title_text='Table title',
                   title_x=0.5, showlegend=False)
fig = go.Figure(data=[table_trace], layout=layout)

When you are interested on a trace type attributes, just print(help(go.Table.cells)) (this is for Table cells).
Displaying cell attributes you can see that the only posibility is to set line_color, and line_width (inspect line properties with help(go.Scatter.line), because they are the same. Hence you cannot set a double boundary line.

Thanks again, How I can change the comma for dot ?

@vitorsc23 I realized that you posted your question in a thread that has no relationship with your issue.

Please open a new thread “How to set point separator for thousands in go.Table”, to be easily found by other users interested in this topic.

Then I’ll post the answer there.

Please don’t insert your questions anywhere on this forum!!! :frowning:

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online