The title states it all. Here an example with the Julia code without the requested part.
using DataFrames
using PlotlyJS
df = DataFrame(
x = 1:5,
a = rand(5),
b_calc = rand(5),
c = rand(5),
d_calc = rand(5)
)
fig = plot()
for tag in [:a, :b_calc, :c, :d_calc]
add_trace!(fig, scatter(x=df.x, y=df[!, tag], name=tag))
end
In Python a possible example of the requested part would be
# corresponding Python code of what I want to achieve in Julia
# adapt line style when the trace name ends with "_calc"
fig.for_each_trace(
lambda trace:
trace.update(
line_dash="dash",
) if trace.name.endswith("_calc") else (),
)
Unfortunately I couldn’t find an equivalent of for_each_trace
in the corresponding Julia documentation parts. I had a look at
- https://github.com/JuliaPlots/PlotlyJS.jl/blob/master/docs/src/manipulating_plots.md and
- Fundamentals in Julia
Can this be achieved without such an equivalent command which is the reason it doesn’t exist?