[英]How to change the Y-Axis in Plotly to go from scientific to exponential or plain?
我看到了許多不同的答案,但需要一個專門用於 Python 中的 Plotly ....我的代碼在下面,但 Y 軸不會以基本小數點返回(我相信它以某種微格式返回,其中而不是 .000258 它將顯示 258.XXX)
floki_ohlc = df.iplot(kind = "ohlc",fill = True, colorscale = "rdylbu", theme = "solar",
title = "FLOKI INU/USDT", xTitle = "Time", yTitle = "Price (USD)")
而且我在文檔中找不到任何關於更改值的內容,只有標題。
提前致謝@
我猜你正在使用快遞。 我將 R 庫 ggplot2 中的鑽石數據集用於 plot。
可以在Python創建圖的時候完成。 因為我沒有你的數據,所以我做了幾個例子,以及我使用它時發生了什么變化以及它是如何變化的。
Plotly 格式使用 D3。 您可以在此處閱讀更多相關信息。
import pandas as pd
pd.options.plotting.backend = "plotly"
diam_py = r.diamonds
df = pd.DataFrame(diam_py)
fig = df.plot.bar(x = "color",
y = "price",
color = "cut",
template = "simple_white",
barmode = "group")
fig.show()
fig.update_yaxes(tickformat=",.0f").show() # use thousand comma; round to whole number
fig.update_yaxes(tickformat="none").show() # show number as is
fig.update_yaxes(tickformat=",.0s").show() # SI prefix with 0 significant digits
fig.update_yaxes(tickformat="#x").show() # prefixed lowercase hexidecimal
# more details at https://github.com/d3/d3-format
這些數字按照它們在代碼中出現的順序排列。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.