Exemplo n.º 1
0
def test_plot_title_and_aes_label():
    spec_list = gg.labs(title='New plot title', x='New X label')
    assert isinstance(spec_list, FeatureSpecArray)
    for spec in spec_list.elements():
        assert isinstance(spec, FeatureSpec)
        assert spec.kind in ('scale', 'ggtitle')
        if spec.kind == 'ggtitle':
            assert spec.props()['text'] == 'New plot title'
        else:
            assert spec.props()['aesthetic'] == 'x'
            assert spec.props()['name'] == 'New X label'
Exemplo n.º 2
0
def test_plot_ggtitle():
    plot = gg.ggplot()
    ggtitle = gg.labs(title="New plot title")

    expect = {
        'ggtitle': {'text': 'New plot title'},
        'kind': 'plot',
        'data_meta': {},
        'layers': [],
        'mapping': {},
        'scales': []
    }

    assert (plot + ggtitle).as_dict() == expect
Exemplo n.º 3
0
def test_aes_label():
    spec = gg.labs(x='New X label')
    as_dict = spec.as_dict()
    assert as_dict['aesthetic'] == 'x'
    assert as_dict['name'] == 'New X label'
Exemplo n.º 4
0
def test_plot_title():
    spec = gg.labs(title='New plot title')
    as_dict = spec.as_dict()
    assert as_dict['text'] == 'New plot title'
Exemplo n.º 5
0
def test_labs_empty():
    spec = gg.labs()
    assert spec.as_dict()['feature-list'] == []