Altex

0.2.0 · active · verified Thu Apr 16

Altex is a Python library that provides a simplified, expressive API wrapper around Altair, designed to facilitate quick chart creation, especially within Streamlit applications. It aims to reduce the boilerplate code typically associated with Altair. The library is currently at version 0.2.0 and has an active development status, with its latest release in late 2025 focusing on dependency reduction and compatibility improvements.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a simple line chart and bar chart using Altex. It uses pandas for data generation and shows an example of displaying the chart directly in a Streamlit application, or by calling `.display()` which is useful in non-Streamlit environments like Jupyter notebooks. The `st.set_page_config` and `st.title`/`st.write` calls are specific to Streamlit.

import altex
import pandas as pd
import streamlit as st # Optional, for rendering in Streamlit

# Create sample data
data = pd.DataFrame({
    'x': range(10),
    'y': [i**2 for i in range(10)]
})

st.set_page_config(layout='wide') # Optional, for Streamlit layout
st.title('Altex Quickstart Chart')

# Create and display charts
st.write("### Line Chart")
altex.line_chart(data=data, x='x', y='y', title='My Line Chart').display() # .display() for non-Streamlit environments

st.write("### Bar Chart with Color")
altex.bar_chart(data=data, x='x', y='y', color='x', title='My Bar Chart').display() # .display() for non-Streamlit environments

view raw JSON →