我的代码:
# launchpad编码的启动成功的线条图
launch_sum = pd.get_dummies(spacex_df,columns=["launchpad"])[["year","launchpad_CCSFS SLC 40","launchpad_KSC LC 39A","launchpad_VAFB SLC 4E","launch_success_True","launch_success_False"]]
launch_sum.rename(columns={"launchpad_CCSFS SLC 40":"CCSFS SLC 40","launchpad_KSC LC 39A":"KSC LC 39A","launchpad_VAFB SLC 4E":"VAFB SLC 4E"},inplace=True)
launch_sum = launch_sum.groupby("year").sum()
px.line(launch_sum, y=["CCSFS SLC 40","KSC LC 39A","VAFB SLC 4E"],title="The Total Annual Attempted Launches")输出是绘图,但我不能更改图例的ylabel和标题。1:https://i.stack.imgur.com/feBYt.png
发布于 2021-12-01 18:33:12
在布局中更新适当标题的简单示例
import pandas as pd
import numpy as np
import plotly.express as px
launch_sum = pd.DataFrame(
{
c: np.random.randint(1, 8, 8)
for c in ["CCSFS SLC 40", "KSC LC 39A", "VAFB SLC 4E"]
},
index=range(2018, 2018 + 8),
)
px.line(
launch_sum,
y=["CCSFS SLC 40", "KSC LC 39A", "VAFB SLC 4E"],
title="The Total Annual Attempted Launches",
).update_layout(yaxis={"title": "some text"}, legend={"title":"column"})https://stackoverflow.com/questions/70188392
复制相似问题