[Python] How to plot multiple Y axis using Altair on Streamlit?

Discussão em 'Python' iniciado por Stack, Julho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am wondering how I can plot multiple Y axis using Altair on Streamlit.

    import pandas as pd
    import numpy as np
    import altair as alt
    import streamlit as st

    df = pd.DataFrame({
    'name': ['brian', 'dominik', 'patricia'],
    'age': [20, 30, 40],
    'salary': [1000, 2000, 3000]
    })

    c = alt.Chart(df).mark_area().encode(
    x='name', y=['age', 'salary'])
    st.altair_chart(c, use_container_width=True)


    The above example returns the following error:

    SchemaValidationError: Invalid specification altair.vegalite.v4.schema.core.FacetedEncoding->0, validating 'type' [{'type': 'quantitative', 'field': 'age'}, {'type': 'quantitative', 'field': 'salary'}] is not of type 'object'

    Continue reading...

Compartilhe esta Página