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
1
vote
1
answer
28
views
Altair chart empty by dropdown when other chart is displayed
I want to have two different charts, where in the first I can choose an artist in a legend and in the second chart I want to have a dropdown, that filters a year. In my database I have artists, sales ...
1
vote
1
answer
37
views
Remove gaps with xOffset
Is there a way to not have gaps at non-existing data when using x/yOffset? In the example below, category B only has 1 group (x) and I would like that bar to be centered at the B-tick.
source = pd....
1
vote
1
answer
27
views
Bars not extending the full size in Vega/Altair plot
I'm trying to plot a histogram from pre-binned data using Vega-lite (Actually, Altair in Python, but I got the issue when using Vega directly as well). My dataset contains the following fields:
bin: ...
1
vote
0
answers
44
views
Display only the first value of the dropdown menu. on Altair Chart
I would like my chart to show only the first value of the dropdown menu (the red dots representing "USA" in my case), instead of displaying all of the countries prior to any filtering. I ...
0
votes
1
answer
33
views
Reorder a stacked barplot in altair
So I am making an interactive plot (which is why I'm using altair) and I want to reorder the stacks within each bar to match the legend. I've tried reodering the df, I've tried using the 'sort' ...
3
votes
1
answer
69
views
Altair - Boxplot border to be set black and median line red
I want to set a black border color to the boxplot of a altair graph, i try to add stroke parameter to black on the encoding chanel but this overrided my red median line to black.
This is the code I am ...
0
votes
0
answers
57
views
Altair use multiple selections in multi-layer chart
I would like to have multiple selections in a multi-layer chart. One selection should highlight the closest line and the other should highlight the point on each line closest to the current x position ...
0
votes
0
answers
27
views
Linking Geospatial data to a bar chart
I am attemtping to link two graphs together, a geospatial graph of Philladelphia outlining its districts along with a bar chart that shows the amount of complaints against police per district. This is ...
2
votes
0
answers
24
views
Use value of alt.selection_point as sort field
I have the following facet chart where the order of the facet panels is determined by the column foo. I would like to add a drop-down box where I can select to dynamically update the sort order of the ...
1
vote
1
answer
27
views
Altair Graph in Notebook
When I tried to draw the graph of USGS earthquakes using Altair, it always gives me blank graph. Here are my codes
current_time = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S')
api_url = "https:...
2
votes
1
answer
124
views
Building plots with plotnine and Python
I am looking for a way that I can modify plots by adding to an existing plot object. For example, I want to add annotations at particular dates in a work plot, but want a standard way of building the ...
2
votes
1
answer
52
views
Concatenate two geoshape charts in Altair / Vega-Lite with independent axis?
I am trying to plot two separate geoshape charts and concatenate them together. Below is a MWE of what I am trying to do:
import altair as alt
from vega_datasets import data
import geopandas as gpd
...
1
vote
0
answers
26
views
Mark_text Altair doesn't working with multiple data at same month
I'm writing a code in python with altair and streamlit.
I wrote all the code and have almost everything working, but im having a issue with multiple data sum() mark_text on same month.
Example:
DT ...
1
vote
1
answer
22
views
Altair Chart selected data to graph
I have a dataframe with multiple type-value pairs. Lets say it is:
dt = pd.DataFrame({'date': ['2022', '2023', '2024'], type':['t1', 't2', 't3'], 'value': [1, 2, 3]})
of cause, with much more data ...
0
votes
1
answer
25
views
Altair - Display multiple names in a tooltip from overlapping points
I am working on a visualization to show when pokemon become available in Pokemon Emerald. After scraping data, I am now beating my head against the wall on how to make multiple names show up when ...