.loc[]
to select a specific pointimport numpy as np
import pandas as pd
import plotly.express as px
df = pd.DataFrame(
{
"x": np.random.uniform(1, 5, 200),
"y": np.random.uniform(2, 4, 200),
"cat": np.random.choice(["one", "two"], 200),
}
)
fig = px.scatter(df, x="x", y="y", color="cat")
fig.add_traces(
px.scatter(df.sample(1), x="x", y="y").update_traces(marker_size=20, marker_color="yellow").data
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.