第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

Plotly:如何使子圖的 x 軸和 y 軸標(biāo)題更大?

Plotly:如何使子圖的 x 軸和 y 軸標(biāo)題更大?

蝴蝶不菲 2023-08-15 16:55:48
我做到了,但我似乎找不到修改它的方法。fig = make_subplots(? ? rows=6, cols=4,? ? subplot_titles=subplot_titles,? ? y_title='Distance (Å)',? ? x_title='Resid ID')positions = [? ? ? ? ? ? ? ? [1, 1], [1, 2], [1, 3], [1, 4],? ? ? ? ? ? ? ? [2, 1], [2, 2], [2, 3], [2, 4],? ? ? ? ? ? ? ? [3, 1], [3, 2], [3, 3], [3, 4],? ? ? ? ? ? ? ? [4, 1], [4, 2], [4, 3], [4, 4],? ? ? ? ? ? ? ? [5, 1], [5, 2], [5, 3], [5, 4],? ? ? ? ? ? ? ? [6, 1], [6, 2], [6, 3], [6, 4],? ? ? ? ? ? ]for i in range(0, len(segids)):? ??? ? fig.add_trace(? ? ? ? go.Scattergl(? ? ? ? ? ? x=resid_titles,? ? ? ? ? ? y=list(copy[segids[i]].values()),? ? ? ? ? ? line=dict(color=colors[0]),? ? ? ? ? ??? ? ? ? ),? ? ? ??? ? ? ??? ? ? ? row=int(positions[i][0]),?? ? ? ? col=int(positions[i][1])? ? )? ??# Set titlefig.update_layout(title_text="Average O5-O3 Distance Per Resid Per Chain")fig.update_layout(? ? title_font_family="Arial",? ? title_font_color="Black",? ? title_font=dict(size=44, family='Courier'),)# Remove the Legendfig.update_layout(showlegend=False)fig.update_xaxes(? ? ? ? ? ? ? ? ?ticks="outside",? ? ? ? ? ? ? ? ?tickwidth=2,? ? ? ? ? ? ? ? ?tickcolor='black',? ? ? ? ? ? ? ? ?tickfont=dict(family='Arial', color='black', size=22),? ? ? ? ? ? ? ? ?title_font=dict(size=44, family='Arial'),? ? ? ? ? ? ? ? ?range=[1, 9],)fig.update_yaxes(? ? ? ? ? ? ? ? ?ticks="outside",?? ? ? ? ? ? ? ? ?tickwidth=2,? ? ? ? ? ? ? ? ?tickcolor='black',?? ? ? ? ? ? ? ? ?tickfont=dict(family='Arial', color='black', size=22),? ? ? ? ? ? ? ? ?title_font=dict(size=44, family='Arial'),? ? ? ? ? ? ? ? ?range=[2, 5])我嘗試過使用他們的 update_xaxes 函數(shù)但不起作用。“Resid ID”和“Distance”軸標(biāo)題 -> 我希望它們更大,也許改變顏色。有沒有一種方法可以實(shí)現(xiàn)我所缺少的?這是一張圖片供參考
查看完整描述

1 回答

?
倚天杖

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超3個(gè)贊

答案:

您可以使用:

fig.for_each_xaxis(lambda axis: axis.title.update(font=dict(color = 'blue', size=20)))

一些細(xì)節(jié):

基于plotly 文檔中的子圖示例,以下代碼片段...

fig.for_each_xaxis(lambda axis: axis.title.update(font=dict(size=24)))
fig.for_each_yaxis(lambda axis: axis.title.update(font=dict(size=24)))

...將改變這個(gè):

https://img1.sycdn.imooc.com//64db3dd100019fab10310649.jpg

...進(jìn)入這個(gè):

https://img1.sycdn.imooc.com//64db3de00001e59810170645.jpg

完整代碼:

from plotly.subplots import make_subplots

import plotly.graph_objects as go


# Initialize figure with subplots

fig = make_subplots(

    rows=2, cols=2, subplot_titles=("Plot 1", "Plot 2", "Plot 3", "Plot 4")

)


# Add traces

fig.add_trace(go.Scatter(x=[1, 2, 3], y=[4, 5, 6]), row=1, col=1)

fig.add_trace(go.Scatter(x=[20, 30, 40], y=[50, 60, 70]), row=1, col=2)

fig.add_trace(go.Scatter(x=[300, 400, 500], y=[600, 700, 800]), row=2, col=1)

fig.add_trace(go.Scatter(x=[4000, 5000, 6000], y=[7000, 8000, 9000]), row=2, col=2)


# Update xaxis properties

fig.update_xaxes(title_text="xaxis 1 title", row=1, col=1)

fig.update_xaxes(title_text="xaxis 2 title", range=[10, 50], row=1, col=2)

fig.update_xaxes(title_text="xaxis 3 title", showgrid=False, row=2, col=1)

fig.update_xaxes(title_text="xaxis 4 title", type="log", row=2, col=2)


# Update yaxis properties

fig.update_yaxes(title_text="yaxis 1 title", row=1, col=1)

fig.update_yaxes(title_text="yaxis 2 title", range=[40, 80], row=1, col=2)

fig.update_yaxes(title_text="yaxis 3 title", showgrid=False, row=2, col=1)

fig.update_yaxes(title_text="yaxis 4 title", row=2, col=2)


# Update title and height

fig.update_layout(title_text="Customizing Subplot Axes", height=700)


# change subplot axes font size

fig.for_each_xaxis(lambda axis: axis.title.update(font=dict(color = 'blue', size=20)))

fig.for_each_yaxis(lambda axis: axis.title.update(font=dict(color = 'blue', size=20)))


fig.show()


查看完整回答
反對 回復(fù) 2023-08-15
  • 1 回答
  • 0 關(guān)注
  • 154 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號