question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transform filter from selection of temporal data is empty

See original GitHub issue

I’m trying to use selection_interval to show a histogram of values selected from a scatterplot. This works fine with quantitative data but fails with temporal data that has not been transformed.

import altair as alt
import pandas as pd
import numpy as np

# Make dataframe from datetimes, random values, and sequential counts
dates = pd.date_range(start='1-1-2017-01', periods=200, freq='H')
values = np.random.randint(0, 20, size=200)
count = range(len(dates))

data = pd.DataFrame({'dt': dates, 'values': values, 'count': count})

brush = alt.selection_interval(encodings=['x'])

points = alt.Chart(data).mark_point().encode(
# Unmodified datetime, counts, and transformed datatime data for the x-axis
    x='dt:T',
#     x='count:Q',
#     x=alt.X('dt:T', timeUnit='yearmonthdatehours', axis=alt.Axis(title='Transformed dt')),
    y='values:Q',
).properties(
    selection=brush
)

bars = alt.Chart(data).mark_bar().encode(
    x='values:Q',
    y='count()'
).transform_filter(
    brush.ref()
)

points | bars

Initial plot with temporal dt on the x-axis image

Empty bar chart/histogram when I select data in the scatterplot image

Works fine with quantitative counts on the x-axis image

Also works when dt is transformed image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jakevdpcommented, May 11, 2018

It’s up to you: free to just report issues here. I’m happy to echo them upstream where it’s appropriate.

0reactions
joelostblomcommented, Feb 23, 2021

@gschivley I am going through Altair issues to find those that have been resolved and can be closed. It looks to me like this issue has been solved in the latest version of Altair so I am closing it, but please feel free to reopen and add a comment if there is something you don’t think is resolved yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filter on null, blank, or empty values | ThoughtSpot Software
Filtering on NULL and empty values is a special case, and can be tricky if your data contains more than one of these....
Read more >
Create an interactive filter for whether a field is empty or ...
You can create a Boolean interactive filter that lets users filter report widgets based on whether a specific field is empty or populated....
Read more >
Row Filtering in Power BI and Power Query: Remove Blank ...
When you have blank values in your data table, you can use Power Query ... transformations in Power Query, the selected column is...
Read more >
Selection Parameters | Vega-Lite
With layered and multi-view displays, a strategy that determines how selections' data queries are resolved when applied in a filter transform, ...
Read more >
Manage historical data in System-Versioned Temporal Tables
Managing temporal table data retention begins with determining ... see Select rows to migrate by using a filter function (Stretch Database).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found