Skip to main content

All Questions

Tagged with
3 votes
1 answer
56 views

Altair Barchart is blank, matplotlib equivalent shows correct visualization

I have been using altair for a time and this is the first time that I have experienced this issue, I have this simple code: import pandas as pd import altair as alt # extract data into a nested list ...
user14398375's user avatar
0 votes
0 answers
36 views

Wrong rectangle width in altair chart for pandas dataframe

I have pandas dataframe which stores currency rate for given day. print(df[['Date', 'Currency', 'Rate']].head()) Date Currency Rate 18 2023-12-01 AUD 1.64655 19 2023-12-01 BRL ...
Jiří Procházka's user avatar
1 vote
1 answer
45 views

Altair: add a line in a grouped bar chart

I have this data that I want to plot. In column 'IPVA' there are [0, 1, 2] as possible values, where 1 and 0 are the data that I want to plot as a grouped bar chart, and the 2 is data that I want to ...
Rafa Roman's user avatar
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 ...
amstuyck88's user avatar
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' ...
youtube's user avatar
  • 425
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 ...
drfqh's user avatar
  • 13
1 vote
0 answers
39 views

chart objects not showing on the chart using selection containing fields with converted columns from datetime data

I am using Altair to create visualisations based on a local csv file about WW1 bombing incidents.nI tried to make 2 charts: one shows all incidents in the same month, one shows all incidents in the ...
Terry563's user avatar
1 vote
2 answers
93 views

Setting order of categorical columns in Altair histogram

Trying to swap order of columns in histogram. data = {'Age group': {0: '0 - 4', 1: '12 - 16', 2: '5 - 11', 3: 'not specified'}, 'Count': {0: 81.0, 1: 86.0, 2: 175.0, 3: 0.0}} dp = pd.DataFrame(data) ...
elksie5000's user avatar
  • 7,580
-1 votes
1 answer
53 views

How to use indexed data frames with altair?

Lets say I have an indexed pandas DataFrame indexed_df: df = pd.DataFrame( [ {'id_foo': 1, 'energy_carrier': 'oil', '2000': 5, '2020': 10}, {'id_foo': 2, 'energy_carrier': '...
Stefan's user avatar
  • 11.6k
1 vote
1 answer
66 views

How to create stacked bar chart from different data format with altair in python?

What y-expression should I specify in the following example to create a stacked bar chart? Is there some expression like y="$all-other-columns" or y="$group-of-columns" Or would ...
Stefan's user avatar
  • 11.6k
1 vote
0 answers
48 views

Separate axis labels on two axis in altair

I am trying to use this code as an example to separate the axis labels for the y axis on the left and on the right side together. import altair as alt import pandas as pd df = pd.DataFrame( { ...
Revan's user avatar
  • 2,282
0 votes
1 answer
44 views

Choropleth doesn't display in Altair

I'm trying to create a choropleth from some data but something isn't working. import altair as alt import pandas as pd from vega_datasets import data dat = { 'country': [ 'France', '...
elksie5000's user avatar
  • 7,580
0 votes
2 answers
109 views

Altair: Apply condition to axis label color based on label membership in a list

I have a scheduling plot where the Y axis is categorical (each Y-entry corresponds to a piece of equipment and the x axis displays time). I have a list of equipment that contains scheduling clashes. ...
multipitch's user avatar
-1 votes
1 answer
79 views

Altair combining multiple data sets ( one my uploaded, another Altair)

im started to enjoy Altair plotting and i found their One Dot Per Zip map and i kinda have an interest to combine Altair long/lat/zips with my own pandas dataframe containing zips but i dont know how. ...
MrEvo's user avatar
  • 29
1 vote
0 answers
68 views

Layout of plot in Altair is not appearing to show conditional colours in time series plot

I've got some data on admissions in long format about obesity-related hospital admissions - you can see the full dataset here: https://www.dropbox.com/scl/fi/6hu7g556pzcyfkhhp1s5l/sorted_data.csv?...
elksie5000's user avatar
  • 7,580

15 30 50 per page
1
2 3 4 5
11