Exemplo n.º 1
0
    def plot(i):
        if i == 2:
            p = qplot(x, y, xlab='x', ylab='y')
        else:
            p = (qplot(x, y, color=colors[i], xlab='x', ylab='y')
                 + lims(color=(1, 7))
                 + labs(color='color'))

        return p + theme_minimal()
Exemplo n.º 2
0
    def plot(i):
        if i == 2:
            p = qplot(x, y, xlab='x', ylab='y')
        else:
            p = (qplot(x, y, color=colors[i], xlab='x', ylab='y')
                 + lims(color=(1, 7))
                 + labs(color='color'))

        return p + theme_minimal()
Exemplo n.º 3
0
 def plot(i):
     c = colors[i]
     if i == 2:
         p = (qplot(x, y, color=c, xlab='x', ylab='y')
              + lims(color=(1, 7))
              + labs(color='color'))
     else:
         p = (qplot(x, y, stroke=c, xlab='x', ylab='y')
              + lims(stroke=(1, 7))
              + labs(stroke='stroke'))
     return p + theme_minimal()
Exemplo n.º 4
0
 def plot(i):
     c = colors[i]
     if i == 2:
         p = (qplot(x, y, color=c, xlab='x', ylab='y')
              + lims(color=(1, 7))
              + labs(color='color'))
     else:
         p = (qplot(x, y, stroke=c, xlab='x', ylab='y')
              + lims(stroke=(1, 7))
              + labs(stroke='stroke'))
     return p + theme_minimal()
Exemplo n.º 5
0
 def plot(i):
     return (qplot(x, y, color=colors[i], xlab='x', ylab='y')
             + lims(color=(1, 7))
             + labs(color='color')
             + theme_minimal()
             + _theme
             )
Exemplo n.º 6
0
 def plot(i):
     return (qplot(x, y, color=colors[i], xlab='x', ylab='y')
             + lims(color=(1, 7))
             + labs(color='color')
             + theme_minimal()
             + _theme
             )
Exemplo n.º 7
0
def test_series_labelling():
    df = pd.DataFrame({
        'x_axis_label': [1, 2, 3],
        'y_axis_label': [1, 2, 3],
        'color_label': ['a', 'b', 'c']
    })
    p = qplot(df.x_axis_label, df.y_axis_label, color=df.color_label)
    assert p + _theme == 'series_labelling'
Exemplo n.º 8
0
def test_multiple_geoms():
    n = 3
    m = 10
    # n stairs of points, each m points high
    df = pd.DataFrame({'x': np.repeat(range(n), m),
                       'y': np.linspace(0, n, n*m)})
    p = qplot('factor(x)', 'y', data=df, geom=("boxplot", "point"))
    assert p == 'multiple_geoms'
Exemplo n.º 9
0
def test_multiple_geoms():
    n = 3
    m = 10
    # n stairs of points, each m points high
    df = pd.DataFrame({'x': np.repeat(range(n), m),
                       'y': np.linspace(0, n, n*m)})
    p = qplot('factor(x)', 'y', data=df, geom=("boxplot", "point"))
    assert p == 'multiple_geoms'
Exemplo n.º 10
0
 def plot(i):
     if i == 2:
         _lims = lims(color=(3, 7))
     else:
         _lims = lims(color=(1, 7))
     return (qplot(x, y, color=colors[i], xlab='x', ylab='y')
             + _lims
             + labs(color='color')
             + theme_minimal()
             + _theme
             )
Exemplo n.º 11
0
 def plot(i):
     if i == 2:
         _lims = lims(color=(3, 7))
     else:
         _lims = lims(color=(1, 7))
     return (qplot(x, y, color=colors[i], xlab='x', ylab='y')
             + _lims
             + labs(color='color')
             + theme_minimal()
             + _theme
             )
Exemplo n.º 12
0
def test_range():
    p = qplot(x=range(5), y=range(5))

    assert p == 'range'
Exemplo n.º 13
0
def test_string_arrays():
    p = qplot(x='np.arange(5)', y='np.arange(5)')
    assert p == 'string-arrays'
Exemplo n.º 14
0
def test_arrays():
    p = qplot(x=np.arange(5), y=np.arange(5))
    assert p == 'arrays'
Exemplo n.º 15
0
def test_scalars():
    p = qplot(x=2, y=3)
    assert p == 'scalars'
Exemplo n.º 16
0
def test_arrays():
    p = qplot(x=np.arange(5), y=np.arange(5))
    assert p == 'arrays'
Exemplo n.º 17
0
def test_sample():
    p = qplot(sample='np.arange(5)')
    assert p == 'sample'
Exemplo n.º 18
0
def test_range():
    p = qplot(x=range(5), y=range(5))

    assert p == 'range'
Exemplo n.º 19
0
def test_scalars():
    p = qplot(x=2, y=3)
    assert p == 'scalars'
Exemplo n.º 20
0
def test_onlyx():
    p = qplot(x='np.arange(5)')
    assert p == 'onlyx'
Exemplo n.º 21
0
def test_onlyy():
    p = qplot(y=np.arange(5))

    # Small displacement in x-label on travis
    assert p == ('range', {'tol': 8})
Exemplo n.º 22
0
def test_series_labelling():
    df = pd.DataFrame({'x_axis_label': [1, 2, 3],
                       'y_axis_label': [1, 2, 3],
                       'color_label': ['a', 'b', 'c']})
    p = qplot(df.x_axis_label, df.y_axis_label, color=df.color_label)
    assert p + _theme == 'series_labelling'
Exemplo n.º 23
0
def test_onlyx():
    p = qplot(x='np.arange(5)')
    assert p == 'onlyx'
Exemplo n.º 24
0
def test_onlyy():
    p = qplot(y=np.arange(5))

    # Small displacement in x-label on travis
    assert p == ('range', {'tol': 8})
Exemplo n.º 25
0
def test_string_arrays():
    p = qplot(x='np.arange(5)', y='np.arange(5)')
    assert p == 'string-arrays'
Exemplo n.º 26
0
def test_onlyx():
    p = qplot(x='np.arange(5)')
    with pytest.warns(PlotnineWarning):
        assert p == 'onlyx'
Exemplo n.º 27
0
def test_sample():
    p = qplot(sample='np.arange(5)')
    assert p == 'sample'