Ejemplo n.º 1
0
def test_get_bar_labels(scene):
    chart = BarChart(values=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
                     y_range=[0, 10, 1])

    c_bar_lbls = chart.get_bar_labels(color=WHITE,
                                      label_constructor=MathTex,
                                      font_size=36)

    scene.add(chart, c_bar_lbls)
Ejemplo n.º 2
0
def test_negative_values(scene):
    chart = BarChart(
        values=[-5, 40, -10, 20, -3],
        bar_names=["one", "two", "three", "four", "five"],
        y_range=[-20, 50, 10],
    )

    c_bar_lbls = chart.get_bar_labels()

    scene.add(chart, c_bar_lbls)
Ejemplo n.º 3
0
def test_change_bar_values_some_vals(scene):
    chart = BarChart(
        values=[-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10],
        y_range=[-10, 10, 2],
        y_axis_config={"font_size": 24},
    )
    scene.add(chart)

    chart.change_bar_values([-6, -4, -2])

    scene.add(chart.get_bar_labels(font_size=24))
Ejemplo n.º 4
0
def test_change_bar_values_negative(scene):
    chart = BarChart(
        values=[-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10],
        y_range=[-10, 10, 2],
        y_axis_config={"font_size": 24},
    )
    scene.add(chart)

    chart.change_bar_values(
        list(reversed([-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10])))

    scene.add(chart.get_bar_labels(font_size=24))
Ejemplo n.º 5
0
def test_advanced_customization(scene):
    """Tests to make sure advanced customization can be done through :class:`~.BarChart`"""
    chart = BarChart(values=[10, 40, 10, 20],
                     bar_names=["one", "two", "three", "four"])

    c_x_lbls = chart.x_axis.labels
    c_x_lbls.set_color_by_gradient(GREEN, RED, YELLOW)

    c_y_nums = chart.y_axis.numbers
    c_y_nums.set_color_by_gradient(BLUE, WHITE).shift(LEFT)

    c_y_axis = chart.y_axis
    c_y_axis.ticks.set_color(YELLOW)

    c_bar_lbls = chart.get_bar_labels()

    scene.add(chart, c_bar_lbls)