prof-rossetti / python-for-finance

https://prof-rossetti.github.io/python-for-finance/
1 stars 1 forks source link

Dataviz - Axis Formatting #13

Open s2t2 opened 4 months ago

s2t2 commented 4 months ago
fig = px.line(x=dates, y=prices,
        title="Stock Price Over Time", height= 350,
        labels={"x": "Date", "y": "Stock Price ($)"}
)
# https://stackoverflow.com/questions/58140143/add-currency-symbol-in-the-y-axis-scale-using-plotly-method-in-python
fig.update_layout(
    yaxis_tickprefix = '$', 
    #yaxis_tickformat = ',.' # thousands sep
    yaxis_tickformat = ',.2f' # thousands sep with two decimal places
)
fig.show()

newplot (9)