2017-08-09 73 views
1
的字體

我有一張表格,我製作了一個表格,我想將字體更改爲'Gill Sans'。Plotly Python - 更改表格

我無法使其更改。這可能嗎?

這是我的代碼:

groupA = new_df.groupby('Call').agg({'TotalGrantValue':sum, 'FirstReceivedDate':'count'}).rename(columns={'FirstReceivedDate':'Count'}) 
groupA['TotalGrantValue'] = groupA['TotalGrantValue'].map('{:,.2f}'.format) 

colorscale = [[0, '#7f7f7f'],[.5, '#F1EDED'],[1, '#ffffff']] 

table = ff.create_table(groupA, index=True,colorscale=colorscale, height_constant=14, index_title='Date') 
table.layout.width = 700 
for i in range(len(table.layout.annotations)): 
    table.layout.annotations[i].font.size = 10 
plotly.offline.iplot(table, config={"displayModeBar": False}, show_link=False, filename='index_table_pd') 

回答

1

您需要按照規定https://plot.ly/python/axes/定義佈局參數。

在同一頁面中,有一個示例代碼,應該幫助你:

layout = go.Layout(
    xaxis=dict(
     title='AXIS TITLE', 
     titlefont=dict(
      family='Arial, sans-serif', 
      size=18, 
      color='lightgrey' 
     ), 
     showticklabels=True, 
     tickangle=45, 
     tickfont=dict(
      family='Old Standard TT, serif', 
      size=14, 
      color='black' 
     ), 
     exponentformat='e', 
     showexponent='All' 
    ), 
    yaxis=dict(
     title='AXIS TITLE', 
     titlefont=dict(
      family='Arial, sans-serif', 
      size=18, 
      color='lightgrey' 
     ), 
     showticklabels=True, 
     tickangle=45, 
     tickfont=dict(
      family='Old Standard TT, serif', 
      size=14, 
      color='black' 
     ), 
     exponentformat='e', 
     showexponent='All' 
    ) 
) 
fig = go.Figure(data=data, layout=layout) 
py.iplot(fig, filename='axes-labels') 
+0

謝謝FedRo,我現在檢查出來:) – ScoutEU

+0

歡迎您:) – FedRo