Ejemplo n.º 1
0
def test_setting_limits_transformed():
    lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

    s = scale_y_continuous(trans='log10')
    s.train(lst)
    assert s.limits == (1, 10)

    s = scale_y_continuous(trans='log10', limits=[2, 7])
    s.train(lst)
    assert s.limits == (np.log10(2), np.log10(7))

    s = scale_y_continuous(trans='log10', limits=[2, None])
    s.train(lst)
    assert s.limits == (np.log10(2), np.log10(10))

    s = scale_y_continuous(trans='log10', limits=[None, 7])
    s.train(lst)
    assert s.limits == (np.log10(1), np.log10(7))
Ejemplo n.º 2
0
def test_xy_palette():
    s = scale_x_discrete()
    value = s.palette(3)
    assert (value == 3)

    s = scale_y_discrete()
    value = s.palette(11.5)
    assert (value == 11.5)

    s = scale_x_continuous()
    value = s.palette(3.63)
    assert (value == 3.63)

    s = scale_y_continuous()
    value = s.palette(11.52)
    assert (value == 11.52)