Artifact with mark_area() when coloring intervals
See original GitHub issueI am attempting to shade an area under a curve between two points to demonstrate an integral, but I get a strange plotting artifact:
import numpy as np
import altair as alt
import pandas as pd
x = np.arange(-1,1,0.01)
y = np.exp(x)
A = (-0.8<=x) & (x<0.8)
data = pd.DataFrame({'x':x, 'y':y, 'A':A})
alt.Chart(data).mark_area().encode(x='x', y='y', color='A:N')
The behavior is different if I set different limits for the shaded area:
A = (-1<=x) & (x<0)
data = pd.DataFrame({'x':x, 'y':y, 'A':A})
alt.Chart(data).mark_area().encode(x='x', y='y', color='A:N')
Perhaps I am misusing mark_area()
, but I can’t find anything in the documentation or other issues discussing how to do this correctly, and the fact that the behavior is different in these two cases makes me think it’s a bug, not misuse.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
CSC 373 Lecture # 2 Instructor: Milad Eftekhar Interval ...
Interval Coloring (a.k.a. Interval Partitioning): ... Goal: Color all the intervals with as few colors as possible so that intervals having the same...
Read more >Graph coloring with intervals Gurobi constraints - Stack Overflow
Using this code, the model is unfeasible. I know that variable x and constraints 2a are defined in the right way. I'm not...
Read more >[1802.09503] Online Coloring of Short Intervals - arXiv
Abstract: We study the online graph coloring problem restricted to the intersection graphs of intervals with lengths in [1,\sigma].
Read more >Interval Graph Coloring Problem - Gustavus Adolphus College
Interval Graph Coloring Problem. GT: Ch 10.2. Problem. Given n lectures, each with a start time and a finish time, find a minimum...
Read more >Interval edge coloring - Wikipedia
In graph theory, interval edge coloring is a type of edge coloring in which edges are labeled by the integers in some interval,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The best way to avoid a space between the sections would probably be to use a layer with the filtered dataset:
Oh, your working example has space between the sections, so I thought that was what you were expecting.