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
42
votes
2
answers
13k
views
Plotly express vs. Altair/Vega-Lite for interactive plots
Recently I am learning both Plotly express and Altair/Vega-Lite for interactive plotting. Both of them are quite impressive and I am wondering what their strengths and weaknesses are. Especially for ...
26
votes
6
answers
24k
views
multiple column/row facet wrap in altair
In ggplot2, it's easy to create a faceted plot with facets that span both rows and columns. Is there a "slick" way to do this in altair? facet documentation
It's possible to have facets plot in a ...
20
votes
3
answers
9k
views
How to add a subtitle to an Altair-generated chart
It seems like you can't add a subtitle yet to a title on a graph made using the Altair Python library.
I love Altair, but according to the threads I've found Altair doesn't have a subtitling ...
20
votes
3
answers
23k
views
Changing the size of Altair plot renders in Jupyter notebook
I am rendering Altair plots in Jupyter notebook (not JupyterLab) using:
alt.renderers.enable('notebook')
And everything works fine, however the plots are often small relative to the width of my ...
20
votes
1
answer
13k
views
altair remove or suppress automatically generated plot legend
When using the altair package I've noticed that when a chart is created a plot legend is also generated. The follow code:
import altair as alt
from vega_datasets import data
alt.renderers.enable('...
20
votes
1
answer
15k
views
How do you set Axis FontSize in Altair?
I would like to increase the X-Axis (or Y-Axis for that matter) fontSize to 16 (or any value) in the following Altair graph. I could not find any example in the Altair documentation here: https://...
15
votes
1
answer
36k
views
How to adjust scale ranges in altair?
I'm having trouble getting all of the axes onto the same scale when using altair to make a group of plots like so:
class_list = ['c-CS-m','c-CS-s','c-SC-m','c-SC-s','t-CS-m','t-CS-s','t-SC-m','t-SC-s'...
14
votes
2
answers
19k
views
Order bar chart in Altair?
How can I order my bar chart so that it is in the order of greatest to least value? I tried the below code, but it isn't giving me the expected result.
I would like the bars ordered 'b', 'a', 'c' (by ...
14
votes
1
answer
18k
views
Increase Font Size of Chart Title in Altair
I can't figure out how to increase the size of the font for the chart title in Altair. My code will only change the font size for the axis titles, but not for the chart title.
Here's what I tested ...
14
votes
2
answers
5k
views
Can we plot image data in Altair?
I am trying to plot image data in altair, specifically trying to replicate face recognition example in this link from Jake VDP's book - https://jakevdp.github.io/PythonDataScienceHandbook/05.07-...
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='...
13
votes
2
answers
6k
views
Is there a way to format tooltip values in Altair boxplot
Is is possible to format the values within a tooltip for a boxplot? From this Vega documentation, it appears so, but I can't quite figure out how to do it with Altair for python
from vega_datasets ...
13
votes
1
answer
11k
views
Controlling Bin Widths in Altair
I have a set of numbers that I'd like to plot on a histogram.
Say:
import numpy as np
import matplotlib.pyplot as plt
my_numbers = np.random.normal(size = 1000)
plt.hist(my_numbers)
If I want to ...
12
votes
3
answers
7k
views
Making dashboards using altair
I would like to use the excellent altair library to create dashboards. Is there a way to create the dashboards and not show any code? I see some really nice examples here: https://altair-viz.github.io/...
12
votes
1
answer
7k
views
Altair: Can't facet layered plots
I read in the documentation that I can facet a multi-layer plot, but somehow the data are lumped together in output plot, and repeated in all facets.
I can facet each layer with no problem, here is ...