Questions tagged [altair]
Altair is a declarative statistical visualization library for Python, based on Vega-Lite. It provides a high-level API for creating complex visualizations with minimal code. Please include code and sample data in your question.
altair
1,375
questions
0
votes
1
answer
97
views
Altair choropleth not rendering in streamlit app on Snowflake and color coding problem
I am trying to make a choropleth map in a streamlit app on Snowflake.
Outside of snowflake, I can use the following code to render a map where just one county in Alabama is color coded.
import ...
0
votes
0
answers
24
views
Altair - display lines on a mouseover
I'm trying to display lines (link between centroïd and points) on a map only if I pass my mouse over. But I still don't get why it doesn't work.
Do you know any other function with Altair to do it ...
0
votes
0
answers
34
views
How to fix altair transform_filter()?
I'm trying to create a choropleth map of the US displaying the percentages of the population with different disabilities. However, using the drop-down selection tool bar makes the data/color of the ...
1
vote
0
answers
60
views
Select zoom axis per drop-down menu
I have a scatterplot in which I want to zoom on either the y axis, the x axis or both. I would like the user to select this behavior via a dropdown menu.The standard setting would be both like ....
0
votes
0
answers
28
views
Altair sorting not working properly on faceted chart
I have some faceted bar graphs displaying the amounts of different colors in different paintings.
base = alt.Chart(df).mark_bar().encode(
x=alt.X(
'color',
title='',
...
2
votes
1
answer
140
views
Efficient interactive plots of large datasets -- which framework to use?
I have a moderate-to-large dataset of ~500k points which I would to visualize with an interactive 2d scatterplot (ideally through a web-app).
Usually am quite fond of the altair package (Python) for ...
1
vote
1
answer
58
views
Table with multi-line strings in Altair
I was trying to write a table with some entries being multi-line using altair, but seem to get into trouble with fixing line spacing. For example:
text_df = pd.DataFrame({"a":["very ...
0
votes
0
answers
49
views
Convert seconds to days, hours, etc on axis labels
I am trying to plot a chart which needs to have duration times in terms of "days, hours, minutes" on the Y axis and just dates on the X axis. I can do this easily if the duration is ...
1
vote
2
answers
89
views
Custom ordering in a grouped bar chart not applied in Altair?
I am trying to achieve a custom sort order for a series of categories in a grouped bar chart.
An issue on GitHub from a few years ago suggests how to do this: by supplying a list with the custom sort ...
1
vote
0
answers
25
views
How modify altair multiple tooltip by y values
I'm looking to customize the tooltips in my Altair chart. I have two specific requirements:
Order the tooltip lines based on the value of the element, and hide certain tooltip lines depending on their ...
1
vote
1
answer
44
views
Consolidating multiple color legends in layered and faceted Altair plots
In Altair, if I layer two plots with color scales on different attributes and then also facet them I end up with multiple copies of the color legend. If there's just one color scale it correctly ...
1
vote
1
answer
36
views
Overlaid boundary and point Altair plots are not aligning
I've got a layer map plot in Altair of London that I was struggling to flip - Solving upside plot and projection problems in Geopandas and Altair
However, a more troubling problem is that I've got a ...
0
votes
1
answer
61
views
Dynamic label with number of points in scatterplot based on transform selection in Altair?
tl;dr: is there a way to get a dynamic count of points in filtered plots in Altair?
In the 'filtering by selection' example for Altair, it is possible to update a scatterplot based on a selection in ...
1
vote
2
answers
84
views
Solving upside plot and projection problems in Geopandas and Altair
I'm trying to plot a multi-layered map of London using some data from the ONS.
import geopandas as gpd
from shapely import wkt
# Convert the 'geometry' column to shapely geometry objects
...
1
vote
1
answer
33
views
Altair choropleth map doesn't display
I'm trying to create a choropleth from some Kaggle data: https://www.kaggle.com/datasets/jessemostipak/hotel-booking-demand but something isn't working.
import pandas as pd
import altair as alt
from ...