В веб-приложении
My Python имеется «График» Plotly Da sh, легенда которого охватывает метки оси X. Я попытался настроить следующие элементы, но безуспешно и без видимых изменений:
- стиль легенды 'margin-top'
- margin 'b'
- padding 'b'
Вот код:
import dash
import dash_core_components as dcc
import dash_html_components as html
graph = dcc.Graph(
figure = {
'data': data,
'layout': dict(
hovermode = "closest",
height = 400, # 500 is a bit too big on a smartphone
legend = dict(
font=dict(color='#7f7f7f'),
orientation="h", # Looks much better horizontal than vertical
style={'margin-top': 100},
),
font = {
'family': 'Segoe UI',
'color': "#7f7f7f"
},
# Added more margin on the left side to fix the cutoff True/False labels on the booleans
margin = dict(l=40, r=25, b=10, t=10),
padding = dict(l=0, r=0, b=10, t=0),
)
}
)
Вот как это выглядит, показывая легенду, перекрывающую метки оси X: