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
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 ...
0
votes
0
answers
57
views
Get interval selection for a Vega-Altair plot published in streamlit
How can I get the selected datapoints for a Vega-Altair plot publihsed using Streamlit?
I am defining the box selection for selecting datapoints, and it works well. However i am unable to get the ...
1
vote
1
answer
54
views
Calculate new series based on data in filtered altair chart
I have a timeseries dataframe which I'm using to create a heatmap (showing the difference on the most recent observation between the two relevant values) and two line charts -- one showing the series ...
1
vote
0
answers
104
views
How to specify different colors for column labels in altair
Is there a way to specify different colors for column labels with python altair? Take the grouped bar chart example where bars are grouped using the column encode option. I would like to specify ...
1
vote
0
answers
26
views
How to add two side slide button to a line chart based on the year using Altair
i have a line chart that has date as X axis. i want to filter this with a double (two) sided slide button for filtering proposes. So i want to be able to filter the data from starting and end date of ...
1
vote
0
answers
29
views
How to move Altair dropdown to under the legend dynamically (for every screen size)
it's been a while that i have done CSS coding so i need help. i want to move the drop down list from under the chart to under the legend. Dataframe:
data = {
'Adj Close': [1.308934, 2.169581, 2....
1
vote
1
answer
57
views
Undefined colors in Altair plot
I have been making a program in Python with the help of the libraries Altair and Streamlit in order to visualize data on a real time updating dashboard locally. I'll be the first to admit that these ...
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)
...
1
vote
0
answers
21
views
How to use altair.Data
How to use altair.Data?
This data structure is very opaque to me. I checked the doc, https://altair-viz.github.io/user_guide/generated/core/altair.Data.html, but still not sure what it exactly refers ...
2
votes
0
answers
18
views
Add regression lines to a scatter matrix in Altair [duplicate]
Is there any way to add regression lines to a scatter matrix in Altair? I am trying to add a regression line to a scatter matrix that I create with the following code :
scatter_matrix = (
alt....
3
votes
3
answers
379
views
Enable x-zoom in altair chart
I'd like to be able to zoom into my time series in altair. I understand that this is currently still work in progress, but I hoped to be able to circumvent this restriction by the following idea
...
0
votes
0
answers
31
views
Altair will not display chart in google colab
Receiving the following error when trying to display an interactive network + bar graph using Altair and nx_altair:
Javascript Error: Duplicate signal name: "selector003_x_1"
This usually ...
1
vote
1
answer
63
views
How to avoid points being cut off at the edges of the chart
Using the default configuration, points in Altair plots are sometimes cut off at the edges of a chart (here left and top):
Example Altair chart
This is the code that produces the chart:
df = pd....
1
vote
0
answers
50
views
How do I change start date of 'week()' to Monday instead of Sunday in altair?
I am relatively new to coding and altair, and I am currently struggling to change the start date of 'week()' to begin on Monday instead of Sunday. As a distance runner, I track my weekly mileage from ...
0
votes
1
answer
69
views
Vega-Altair: alt.condition() on color with mark_point() vs. mark_line()
I don't understand why the color=alt.condition() works with mark_point() but not with mark_line() in the example below:
import altair as alt
import numpy as np
import pandas as pd
x=np.arange(100)
...