Hi all,
I am playing around with this PlotlyJS, I want to know:
- how to change the marker color so each can have different color.
- how to change the label of x,y,z ? x is for years, y is for pandemics, and z is for Death toll
- How to make the texts a bit apart? use margin? So it can be seen more nicely.
this is the code:
using PlotlyJS
trace = scatter3d(
x=["1346-01-01", "1918-02-10", "1981-03-20","2019-02-20"],
y=["Black Death", "Spanish Flu", "HIV/AIDS","COVID-19"],
z=[200000000, 100000000, 36300000,26000000],
name="Death toll",
)
layout = Layout(
scene=attr(
xaxis=attr(type="date"),
yaxis=attr(type="category"),
zaxis=attr(type="number"),
annotations=[
attr(
showarrow=false,
x="1346-01-01",
y="Black Death",
z=230000000,
text="Global population lost: 17β54%",
#xanchor="left",
xshift=10,
opacity=1.7),
attr(
x="1918-02-10",
y="Spanish Flu",
z=4,
text="Global population lost: 1β5.4%",
textangle=0,
ax=0,
ay=-75,
font=attr(
color="black",
size=12
),
arrowcolor="black",
arrowsize=1,
arrowwidth=1,
arrowhead=1),
attr(
x="1981-03-20",
y="HIV/AIDS",
z=4,
text="Global population lost: 0.2%",
textangle=0),
attr(
x="2019-02-20",
y="COVID-19",
z=5,
ax=50,
ay=0,
text="Global population lost: 0.1-0.3%",
arrowhead=1,
xanchor="left",
yanchor="bottom"
)]
),
)
plot(trace, layout)