# Parallel coordinates plot with PlotlyJS

**URL:** <https://discourse.julialang.org/t/parallel-coordinates-plot-with-plotlyjs/36672>\
**Category:** Visualization\
**Tags:** plotlyjs\
**Created:** [March 29, 2020, 10:01am UTC](https://discourse.julialang.org/t/parallel-coordinates-plot-with-plotlyjs/36672 "2020-03-29T10:01:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![healyp](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@healyp](https://discourse.julialang.org/u/healyp)\
**Post date:** [March 29, 2020, 10:01am UTC](https://discourse.julialang.org/t/parallel-coordinates-plot-with-plotlyjs/36672/1 "2020-03-29T10:01:36Z")

</div>

I would like to use PlotlyJS’s parallel coordinates plot to achieve something similar to this python  
[example](https://plotly.com/python/parallel-coordinates-plot/#basic-parallel-coordinates-plot). I have tried extracting into separate dataframes my separate groupings, built separate traces and then, finally

```julia
plot([trace1, trace2, trace3])

```

but this isn’t doing it for me. Does anybody have any suggestions?

Something along the lines of the example linked above would be even nicer but beggars can’t be choosers 🙂 .

Many thanks.

---

<div class="post-metadata">

**Author:** ![josephmarturano](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@josephmarturano](https://discourse.julialang.org/u/josephmarturano)\
**Post date:** [March 30, 2020, 12:29pm UTC](https://discourse.julialang.org/t/parallel-coordinates-plot-with-plotlyjs/36672/2 "2020-03-30T12:29:21Z")

</div>

Have you tried the approach detailed on the Github PlotlyJS.jl site, here:

[https://github.com/sglyon/PlotlyJS.jl/issues/218#issuecomment-419248422](https://github.com/sglyon/PlotlyJS.jl/issues/218#issuecomment-419248422)

I’m not sure if this is exactly what you want but perhaps it will give you some ideas.

---

<div class="post-metadata">

**Author:** ![healyp](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@healyp](https://discourse.julialang.org/u/healyp)\
**Post date:** [March 30, 2020, 1:26pm UTC](https://discourse.julialang.org/t/parallel-coordinates-plot-with-plotlyjs/36672/3 "2020-03-30T13:26:05Z")

</div>

Thanks for the suggestion. Yes, I knew about it and I had been using it as a starting point, and it got me a long way. However, I was not able to plot sub categories of my dataframe in different line colors and styles.

I’d love to hear of any leads or suggestions.

Thanks.

---

<div class="post-metadata">

**Author:** ![josephmarturano](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@josephmarturano](https://discourse.julialang.org/u/josephmarturano)\
**Post date:** [April 1, 2020, 12:26pm UTC](https://discourse.julialang.org/t/parallel-coordinates-plot-with-plotlyjs/36672/4 "2020-04-01T12:26:55Z")

</div>

Okay. Well here is a MWE that starts with an (unstacked) dataframe and plots a parallel coordinates plot into three groups. Does this help get you closer?

```julia
using PlotlyJS, DataFrames

df = DataFrame(group=repeat([1,2,3], inner=10), response1 = rand(30), response2 = rand(30), response3=rand(30), response4=rand(30));

mytrace = parcoords(;line = attr(color=df.group, colorscale=[(0,"red"), (0.5,"green"),(1,"blue")]),
        dimensions = [
            attr(range = [0,1],
                 label = "response1", values = df.response1),
            attr(range = [0,1],
                 label = "response2", values = df.response2),
            attr(range = [0,1],
                 label = "response3", values = df.response3),
            attr(range = [0,1],
                 label = "response4", values = df.response4)
        ]);

myplot = plot(mytrace)

```

---

<div class="post-metadata">

**Author:** ![healyp](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@healyp](https://discourse.julialang.org/u/healyp)\
**Post date:** [April 1, 2020, 9:15pm UTC](https://discourse.julialang.org/t/parallel-coordinates-plot-with-plotlyjs/36672/5 "2020-04-01T21:15:05Z")

</div>

Thank you. That was the quantum I needed.
