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,376
questions
1
vote
2
answers
1k
views
Add data labels to vega-lite bar chart
I have a rather simple bar chart, created with the Python altair library, based on a Pandas DataFrame.
The code to generate the chart is:
Chart(df).configure(background='white').mark_bar().encode(
...
8
votes
1
answer
9k
views
How to do annotations with Altair
I am trying to write some text inside the figure to highlight something in my plot (equivalent to 'annotate' in matplotlib). Any idea? Thanks
14
votes
2
answers
17k
views
How to create a grouped bar chart in Altair?
How does one create a grouped bar chart in Altair? I'm trying the following but it is just producing two graphs side by side.
Chart(data).mark_bar().encode(
column='Gender',
x='Genre',
y='...
3
votes
1
answer
696
views
Python+Altair (Vega-Lite): Web server
I want to visualize some graphs on web pages using Python 2.7.12 and Altair 1.2.0.
Using their examples it is easy and straightforward:
from altair import *
from altair import Chart, load_dataset
# ...
3
votes
2
answers
1k
views
saving figures in python altair
I am trying to save altair figures in html any graphic format (png, svg).
HTML. The figures in html are not displayed. A blank page
PNG. The documentations says I need canvas package and provides a ...
9
votes
1
answer
2k
views
How to shade a region with Altair
I am trying to shade different regions in my plot created with Altair (like axvspan in matplotlib) but can't find a way to do it.
Chart(data).mark_line(color='r').encode(
x=X('Voltage'),
y=Y(...
2
votes
1
answer
2k
views
python altair line chart cut off by count
I am currently trying to cut off a line chart in Altair. My code so far is:
Chart(orient_frame).mark_line().encode(
x = X('year:O'),
y = Y('count(type:N)', scale=Scale(domain=(0,2500)),
...
2
votes
2
answers
1k
views
[Python+Altair (Vega-lite)]: Streamgraph from excel-like Pandas' Dataframe
I have a Pandas' Dataframe I would like to visualize using Altair, but it looks like the library syntax is yet above my skills:
Time WL1 WL2 WL3 WL4
0 2017-04-05 ...
4
votes
1
answer
269
views
Vegalite daily line chart wobble
I've run into an issue with vegalite whereby charts exhibit a 'wobbling line' when the line should be straight, and dates are not equally spaced.
Can anyone verify that this is a bug, or am I making ...
2
votes
2
answers
3k
views
Cumulative count with altair
I'm trying to plot data with a date as the X axis and several cumulative counts as Ys.
I have a set of items such as:
id1 date1 user1
id2 date2 user1
id3 date3 user2
With this example, I'd want the ...
8
votes
1
answer
6k
views
Overlaying vertical lines onto a plot in Altair
I have a data frame df which looks like this:
+---+------------+-----------+--------+
| | date | violation | pounds |
+---+------------+-----------+--------+
| 0 | 2010-05-13 | N | ...