예제 #1
0
import altair as alt
from utils import save_altair
import numpy as np
import pandas as pd

data = np.load('data/x.npy')
dict = {'x': data[0], 'y': data[1], 'Dataset': ['x' for x in data[0]]}
df = pd.DataFrame(dict)

scales = alt.selection_interval(bind='scales')

plot = alt.Chart(df).mark_circle().encode(
    x='x', y='y').add_selection(scales).properties(title='x',
                                                   width=600,
                                                   height=500)

save_altair('x', plot)
import altair as alt
from utils import save_altair
import numpy as np
import pandas as pd

data = np.load('data/slant_up.npy')
dict = {'x': data[0], 'y': data[1], 'Dataset': ['slant_up' for x in data[0]]}
df = pd.DataFrame(dict)

scales = alt.selection_interval(bind='scales')

plot = alt.Chart(df).mark_circle().encode(
    x='x', y='y').add_selection(scales).properties(title='slant_up',
                                                   width=600,
                                                   height=500)

save_altair('slant_up', plot)
예제 #3
0
import altair as alt
from utils import save_altair
import numpy as np
import pandas as pd

data = np.load('data/bullseye.npy')
dict = {'x': data[0], 'y': data[1], 'Dataset': ['bullseye' for x in data[0]]}
df = pd.DataFrame(dict)

scales = alt.selection_interval(bind='scales')

plot = alt.Chart(df).mark_circle().encode(
    x='x', y='y').add_selection(scales).properties(title='bullseye',
                                                   width=600,
                                                   height=500)

save_altair('bullseye', plot)
예제 #4
0
import altair as alt
from utils import save_altair
import numpy as np
import pandas as pd

data = np.load('data/circle.npy')
dict = {'x': data[0], 'y': data[1], 'Dataset': ['circle' for x in data[0]]}
df = pd.DataFrame(dict)

brush = alt.selection(type='interval', resolve='global')

plot = alt.Chart(df).mark_circle().encode(
    x='x',
    y='y',
    color=alt.condition(
        brush, 'Dataset:N',
        alt.value('lightgray'))).add_selection(brush).properties(width=600,
                                                                 height=500)

save_altair('circle', plot)
예제 #5
0
import altair as alt
from utils import save_altair
import numpy as np
import pandas as pd

data = np.load('data/s.npy')
dict = {'x': data[0], 'y': data[1], 'Dataset': ['s' for x in data[0]]}
df = pd.DataFrame(dict)

brush = alt.selection(type='interval', resolve='global')

plot = alt.Chart(df).mark_circle().encode(
    x='x',
    y='y',
    color=alt.condition(
        brush, 'Dataset:N',
        alt.value('lightgray'))).add_selection(brush).properties(width=600,
                                                                 height=500)

save_altair('s', plot)
예제 #6
0
import altair as alt
from utils import save_altair
import numpy as np
import pandas as pd

data = np.load('data/d.npy')
dict = {'x': data[0], 'y': data[1], 'Dataset': ['d' for x in data[0]]}
df = pd.DataFrame(dict)

brush = alt.selection(type='interval', resolve='global')

plot = alt.Chart(df).mark_circle().encode(
    x='x',y='y',
    color=alt.condition(brush, 'Dataset:N', alt.value('lightgray'))
    ).add_selection(brush).properties(width=600, height=500)

save_altair('d', plot)