Same color sequence with marker and line when using addtraces!

You can specify the colour of the traces as follows:

C = collect(3:13)

colours = ["purple", "orange", "green"]

EA_1 = scatter(x = C, y = 0.97*C .+ 6.1, mode="markers", marker_color=colours[1], name="1K")
EA_2 = scatter(x = C, y = 0.94*C .+ 5.2, mode="markers", marker_color=colours[2], name="2K")
EA_3 = scatter(x = C, y = 0.97*C .+ 2.8, mode="markers", marker_color=colours[3], name="3K")

q_EA = plot([EA_1, EA_2, EA_3])

add_trace!(q_EA,
    scatter(x = C, y = C .+ 6.0, mode="lines", line_color=colours[1], opacity=0.4, showlegend = false)
)
add_trace!(q_EA,
    scatter(x = C, y = 0.9C .+ 5.0, mode="lines", line_color=colours[2], opacity=0.4, showlegend = false)
)
add_trace!(q_EA,
    scatter(x = C, y = C .+ 2.1, mode="lines", line_color=colours[3], opacity=0.4, showlegend = false)
)

q_EA

1 Like