Legend with color and strokeDash

Summary

Hello,
I have a dataframe with 4 variables such as:

T,k,sample,Direction
20,0.2,A,T
100,0.3,A,T
150,0.4,A,T
400,0.5,B,T
20,0.25,B,T
100,0.35,B,T
150,0.45,B,T
400,0.65,B,T
20,0.5,C,I
150,0.6,C,I
400,0.7,C,I

And I would like to have graph of T vs k, and then use different line styles (-, --, …) for the sample variable and markers (o, d, …) for the direction.

I am able to create the dashboard, however, the legend for the line styles does not work well (just shows grey circles, instead of the line style).

Steps to reproduce

I based my code on the example-app-commenting and hereafter I show the relevant lines for this plot.

Code snippet:

    lines = (
        alt.Chart(data, title="T vs k")
        .mark_line()
        .encode(
            x="T",
            y="k",
            color="sample",
            strokeDash="Direction",
        )
    )

Expected behavior:

Attached a screenshot with current and expected/desired behavior

Debug info

  • Streamlit version: 1.14.1
  • Python version: 3.8.12
  • Using Conda? Yes
  • OS version: Windows 10
  • Browser version: Chrome 107

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.