✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Formatting tickvalues with comma at thousandths place

I have an axis with dollar values and I would like to add a dollar sign and comma at the thousands place (e.g. $1,000) to my tick values. I have tried the below and a million other variations ha (it’s a 3D scatter which is why I’m using ‘scene’):

    scene = dict(
         xaxis_tickformat =${:,}

And this gives me the dollar but not the comma. Any help would be incredible – I’m really struggling!


Just perform these xaxis settings:

fig.update_layout(scene_xaxis = dict(exponentformat= "none", 
                                     separatethousands= True,
                                     tickprefix='$') )

to get xaxis tick labels displayed with comma, and $ as prefix.

For more details on exponentformat property see:

Help on property:

    Determines a formatting rule for the tick exponents. For
    example, consider the number 1,000,000,000. If "none", it
    appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If
    "power", 1x10^9 (with 9 in a super script). If "SI", 1G. If
    "B", 1B.
    The 'exponentformat' property is an enumeration that may be specified as:
      - One of the following enumeration values:
            ['none', 'e', 'E', 'power', 'SI', 'B']