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,379
questions
1
vote
0
answers
10
views
altair: how to make an interactive plot with a regression line on top of it?
I'm trying to make an interactive plot that has a regression line on top of it. Here is the plot in the Vega editor and here is a gist of the Altair source (MRE). This is heavily influenced by this ...
0
votes
0
answers
7
views
log-log regression, possible in Altair?
Is there any way to do a log-log regression (both x and y axes are on a logarithmic scale)? Linear-linear, linear-log, log-linear all seem straightforward.
0
votes
1
answer
57
views
Using a list of colors for a bar chart in Altair
I am trying to provide a list of colors to bind to the bar marks in Altair, similar to how matplotlib's pyplot.bar(color=list_of_colors) can specify the color for each individual bar, like in the ...
3
votes
1
answer
54
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
...
0
votes
2
answers
36
views
Remove gap between two graphs with shared axis
Objective
I want to generate a 'double ended' barchart, showing gained points (of some metric) vis-a-vis missed points, something like this:
Result so far
I managed to do this
import altair as alt
...
1
vote
2
answers
42
views
Altair chart legend for subset of data
As an exercise for learning more advanced altair, I'm trying to generate a simplified version of this chart: https://climatereanalyzer.org/clim/t2_daily/?dm_id=world.
To simplify, I'm using gray for ...
1
vote
1
answer
20
views
Inconsistent graphs with Altair despite same package version
I am working on creating graphs using Altair in different environments with different package sets. Despite ensuring the Altair version is consistent across these environments, I am observing ...
1
vote
0
answers
26
views
Python: ImportError: DLL load failed while importing lib: The specified procedure could not be found
python programming newbie here. I was trying to create a simple histogram with altair using the following code. The dataset is large, around 1,000 rows.
count_chart = alt.Chart(df).mark_bar().encode(
...
0
votes
0
answers
35
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 ...
1
vote
1
answer
44
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 ...
2
votes
1
answer
28
views
Altair not displaying data when changing option on dropdown selector
I want to display counts of a certain feature according to the year with an Altair Chart and I want to do it by selecting year as an option of a dropdown selector. It works fine with the 'None' option ...
0
votes
1
answer
28
views
How to phrase selection_point in altair to do a selection_multi?
Altair now warns that selection_multi is deprecated and tells to use selection_point instead. I tried to replace it with same functionality with no success. How should I do it?
1
vote
1
answer
32
views
Clamping Daily Temperature Plot with Altair on Colab
I'm trying to use altair to recreate the world temperature plot from Climate Reanalyzer: https://climatereanalyzer.org/clim/t2_daily/?dm_id=world. The data is pretty easy to load:
import pandas as pd
...
1
vote
1
answer
21
views
Altair Show Axis Tick Labels As Percentage Point
I would like to format axis tick labels as percentage point.
import altair as alt
from vega_datasets import data
source = data.jobs.url
alt.Chart(source).mark_line().encode(
alt.X('year:O'),
...
1
vote
1
answer
27
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 ...