Beispiel #1
0
def test_h_and_v_bars():
    fig, ax = plt.subplots()
    ax.bar(left=D['multi_left'],
           height=D['multi_height'],
           width=10,
           color='green',
           alpha=.5)
    # changing height 10 -> 14 because ValueError if bargap not in [0, 1]
    ax.barh(bottom=D['multi_bottom'],
            width=D['multi_width'],
            height=14,
            color='red',
            alpha=.5)
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        d1, d2 = strip_dict_params(data_dict,
                                   H_AND_V_BARS['data'][data_no],
                                   ignore=['uid'])

        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg

    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   H_AND_V_BARS['layout'])
    assert equivalent, msg
Beispiel #2
0
def test_h_and_v_bars():
    fig, ax = plt.subplots()
    ax.bar(
        left=D["multi_left"],
        height=D["multi_height"],
        width=10,
        color="green",
        alpha=0.5,
    )
    # changing height 10 -> 14 because ValueError if bargap not in [0, 1]
    ax.barh(
        bottom=D["multi_bottom"],
        width=D["multi_width"],
        height=14,
        color="red",
        alpha=0.5,
    )
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        d1, d2 = strip_dict_params(data_dict,
                                   H_AND_V_BARS["data"][data_no],
                                   ignore=["uid"])

        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg

    equivalent, msg = compare_dict(renderer.plotly_fig["layout"],
                                   H_AND_V_BARS["layout"])
    assert equivalent, msg
def test_complicated_line():
    fig, ax = plt.subplots()
    ax.plot(D["x1"], D["y1"], "ro", markersize=10, alpha=0.5, label="one")
    ax.plot(D["x1"], D["y1"], "-b", linewidth=2, alpha=0.7, label="two")
    ax.plot(
        D["x2"],
        D["y2"],
        "b+",
        markeredgewidth=2,
        markersize=10,
        alpha=0.6,
        label="three",
    )
    ax.plot(D["x2"], D["y2"], "--r", linewidth=2, alpha=0.8, label="four")
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        d1, d2 = strip_dict_params(data_dict,
                                   COMPLICATED_LINE["data"][data_no],
                                   ignore=["uid"])

        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg

    equivalent, msg = compare_dict(renderer.plotly_fig["layout"],
                                   COMPLICATED_LINE["layout"])
    assert equivalent, msg
Beispiel #4
0
def test_simple_scatter():
    fig, ax = plt.subplots()
    ax.scatter(D["x1"], D["y1"])
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        equivalent, msg = compare_dict(data_dict, SIMPLE_SCATTER["data"][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig["layout"], SIMPLE_SCATTER["layout"])
    assert equivalent, msg
Beispiel #5
0
def test_simple_line():
    fig, ax = plt.subplots()
    ax.plot(D['x1'], D['y1'], label='simple')
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        equivalent, msg = compare_dict(data_dict, SIMPLE_LINE['data'][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   SIMPLE_LINE['layout'])
    assert equivalent, msg
Beispiel #6
0
def test_double_scatter():
    fig, ax = plt.subplots()
    ax.scatter(D["x1"], D["y1"], color="red", s=121, marker="^", alpha=0.5)
    ax.scatter(D["x2"], D["y2"], color="purple", s=64, marker="s", alpha=0.5)
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        equivalent, msg = compare_dict(data_dict, DOUBLE_SCATTER["data"][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig["layout"], DOUBLE_SCATTER["layout"])
    assert equivalent, msg
Beispiel #7
0
def test_horizontal_bar():
    fig, ax = plt.subplots()
    ax.barh(bottom=D['bottom'], width=D['width'])
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        equivalent, msg = compare_dict(data_dict,
                                       HORIZONTAL_BAR['data'][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   HORIZONTAL_BAR['layout'])
    assert equivalent, msg
Beispiel #8
0
def test_vertical_bar():
    fig, ax = plt.subplots()
    ax.bar(left=D['left'], height=D['height'])
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        equivalent, msg = compare_dict(data_dict,
                                       VERTICAL_BAR['data'][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   VERTICAL_BAR['layout'])
    assert equivalent, msg
Beispiel #9
0
def test_simple_scatter():
    fig, ax = plt.subplots()
    ax.scatter(D['x1'], D['y1'])
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        equivalent, msg = compare_dict(data_dict,
                                       SIMPLE_SCATTER['data'][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   SIMPLE_SCATTER['layout'])
    assert equivalent, msg
Beispiel #10
0
def test_double_scatter():
    fig, ax = plt.subplots()
    ax.scatter(D['x1'], D['y1'], color='red', s=121, marker='^', alpha=0.5)
    ax.scatter(D['x2'], D['y2'], color='purple', s=64, marker='s', alpha=0.5)
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        equivalent, msg = compare_dict(data_dict,
                                       DOUBLE_SCATTER['data'][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   DOUBLE_SCATTER['layout'])
    assert equivalent, msg
Beispiel #11
0
def test_even_linear_scale():
    fig, ax = plt.subplots()
    x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    y = [10, 3, 100, 6, 45, 4, 80, 45, 3, 59]
    ax.plot(x, y)
    _ = ax.set_xticks(list(range(0, 20, 3)))
    _ = ax.set_yticks(list(range(0, 200, 13)))
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        equivalent, msg = compare_dict(data_dict, EVEN_LINEAR_SCALE["data"][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig["layout"], EVEN_LINEAR_SCALE["layout"])
    assert equivalent, msg
Beispiel #12
0
def test_simple_line():
    fig, ax = plt.subplots()
    ax.plot(D["x1"], D["y1"], label="simple")
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        d1, d2 = strip_dict_params(
            data_dict, SIMPLE_LINE["data"][data_no], ignore=["uid"]
        )

        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig["layout"], SIMPLE_LINE["layout"])
    assert equivalent, msg
Beispiel #13
0
def test_h_and_v_bars():
    fig, ax = plt.subplots()
    ax.bar(left=D['multi_left'], height=D['multi_height'],
           width=10, color='green', alpha=.5)
    ax.barh(bottom=D['multi_bottom'], width=D['multi_width'],
            height=10, color='red', alpha=.5)
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        equivalent, msg = compare_dict(data_dict,
                                       H_AND_V_BARS['data'][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   H_AND_V_BARS['layout'])
    assert equivalent, msg
Beispiel #14
0
def test_even_linear_scale():
    fig, ax = plt.subplots()
    x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    y = [10, 3, 100, 6, 45, 4, 80, 45, 3, 59]
    ax.plot(x, y)
    _ = ax.set_xticks(list(range(0, 20, 3)))
    _ = ax.set_yticks(list(range(0, 200, 13)))
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        equivalent, msg = compare_dict(data_dict,
                                       EVEN_LINEAR_SCALE['data'][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   EVEN_LINEAR_SCALE['layout'])
    assert equivalent, msg
Beispiel #15
0
def test_complicated_line():
    fig, ax = plt.subplots()
    ax.plot(D['x1'], D['y1'], 'ro', markersize=10, alpha=.5, label='one')
    ax.plot(D['x1'], D['y1'], '-b', linewidth=2, alpha=.7, label='two')
    ax.plot(D['x2'], D['y2'], 'b+', markeredgewidth=2,
            markersize=10, alpha=.6, label='three')
    ax.plot(D['x2'], D['y2'], '--r', linewidth=2, alpha=.8, label='four')
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        equivalent, msg = compare_dict(data_dict,
                                       COMPLICATED_LINE['data'][data_no])
        assert equivalent, msg
    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   COMPLICATED_LINE['layout'])
    assert equivalent, msg
Beispiel #16
0
def test_horizontal_bar():
    fig, ax = plt.subplots()
    ax.barh(bottom=D["bottom"], width=D["width"])
    renderer = run_fig(fig)

    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        d1, d2 = strip_dict_params(data_dict,
                                   HORIZONTAL_BAR["data"][data_no],
                                   ignore=["uid"])

        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg

    equivalent, msg = compare_dict(renderer.plotly_fig["layout"],
                                   HORIZONTAL_BAR["layout"])
    assert equivalent, msg
Beispiel #17
0
def test_vertical_bar():
    fig, ax = plt.subplots()
    ax.bar(left=D["left"], height=D["height"])
    renderer = run_fig(fig)

    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        d1, d2 = strip_dict_params(data_dict,
                                   VERTICAL_BAR["data"][data_no],
                                   ignore=["uid"])

        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg

    equivalent, msg = compare_dict(renderer.plotly_fig["layout"],
                                   VERTICAL_BAR["layout"])
    assert equivalent, msg
Beispiel #18
0
def test_h_and_v_bars():
    fig, ax = plt.subplots()
    ax.bar(left=D['multi_left'], height=D['multi_height'],
           width=10, color='green', alpha=.5)
    # changing height 10 -> 14 because ValueError if bargap not in [0, 1]
    ax.barh(bottom=D['multi_bottom'], width=D['multi_width'],
            height=14, color='red', alpha=.5)
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        d1, d2 = strip_dict_params(data_dict, H_AND_V_BARS['data'][data_no], ignore=['uid'])

        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg

    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   H_AND_V_BARS['layout'])
    assert equivalent, msg
def test_even_linear_scale():
    fig, ax = plt.subplots()
    x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    y = [10, 3, 100, 6, 45, 4, 80, 45, 3, 59]
    ax.plot(x, y)
    _ = ax.set_xticks(list(range(0, 20, 3)), True)
    _ = ax.set_yticks(list(range(0, 200, 13)), True)
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        # equivalent, msg = compare_dict(data_dict.to_plotly_json(),
        #                                EVEN_LINEAR_SCALE['data'][data_no].to_plotly_json())
        # assert equivalent, msg
        d1, d2 = strip_dict_params(data_dict, EVEN_LINEAR_SCALE['data'][data_no], ignore=['uid'])

        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg

    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   EVEN_LINEAR_SCALE['layout'])
    assert equivalent, msg
Beispiel #20
0
def test_annotations():
    fig, ax = plt.subplots()
    ax.plot([1, 2, 3], 'b-')
    ax.plot([3, 2, 1], 'b-')
    ax.text(0.001, 0.999,
            'top-left', transform=ax.transAxes, va='top', ha='left')
    ax.text(0.001, 0.001,
            'bottom-left', transform=ax.transAxes, va='baseline', ha='left')
    ax.text(0.999, 0.999,
            'top-right', transform=ax.transAxes, va='top', ha='right')
    ax.text(0.999, 0.001,
            'bottom-right', transform=ax.transAxes, va='baseline', ha='right')
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        equivalent, msg = compare_dict(data_dict,
                                       ANNOTATIONS['data'][data_no])
        assert equivalent, msg
    for no, note in enumerate(renderer.plotly_fig['layout']['annotations']):
        equivalent, msg = compare_dict(note,
                                       ANNOTATIONS['layout']['annotations'][no])
        assert equivalent, msg
Beispiel #21
0
def test_annotations():
    fig, ax = plt.subplots()
    ax.plot([1, 2, 3], 'b-')
    ax.plot([3, 2, 1], 'b-')
    ax.text(0.001, 0.999,
            'top-left', transform=ax.transAxes, va='top', ha='left')
    ax.text(0.001, 0.001,
            'bottom-left', transform=ax.transAxes, va='baseline', ha='left')
    ax.text(0.999, 0.999,
            'top-right', transform=ax.transAxes, va='top', ha='right')
    ax.text(0.999, 0.001,
            'bottom-right', transform=ax.transAxes, va='baseline', ha='right')
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        d1, d2 = strip_dict_params(data_dict, ANNOTATIONS['data'][data_no], ignore=['uid'])
        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg
    for no, note in enumerate(renderer.plotly_fig['layout']['annotations']):
        equivalent, msg = compare_dict(note,
                                       ANNOTATIONS['layout']['annotations'][no])
        assert equivalent, msg
Beispiel #22
0
def test_even_linear_scale():
    fig, ax = plt.subplots()
    x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    y = [10, 3, 100, 6, 45, 4, 80, 45, 3, 59]
    ax.plot(x, y)
    _ = ax.set_xticks(list(range(0, 20, 3)), True)
    _ = ax.set_yticks(list(range(0, 200, 13)), True)
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        # equivalent, msg = compare_dict(data_dict.to_plotly_json(),
        #                                EVEN_LINEAR_SCALE['data'][data_no].to_plotly_json())
        # assert equivalent, msg
        d1, d2 = strip_dict_params(data_dict,
                                   EVEN_LINEAR_SCALE['data'][data_no],
                                   ignore=['uid'])

        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg

    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   EVEN_LINEAR_SCALE['layout'])
    assert equivalent, msg
Beispiel #23
0
def test_annotations():
    fig, ax = plt.subplots()
    ax.plot([1, 2, 3], "b-")
    ax.plot([3, 2, 1], "b-")
    ax.text(0.001,
            0.999,
            "top-left",
            transform=ax.transAxes,
            va="top",
            ha="left")
    ax.text(0.001,
            0.001,
            "bottom-left",
            transform=ax.transAxes,
            va="baseline",
            ha="left")
    ax.text(0.999,
            0.999,
            "top-right",
            transform=ax.transAxes,
            va="top",
            ha="right")
    ax.text(0.999,
            0.001,
            "bottom-right",
            transform=ax.transAxes,
            va="baseline",
            ha="right")
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        d1, d2 = strip_dict_params(data_dict,
                                   ANNOTATIONS["data"][data_no],
                                   ignore=["uid"])
        equivalent, msg = compare_dict(d1, d2)
        assert equivalent, msg
    for no, note in enumerate(renderer.plotly_fig["layout"]["annotations"]):
        equivalent, msg = compare_dict(
            note, ANNOTATIONS["layout"]["annotations"][no])
        assert equivalent, msg
Beispiel #24
0
def test_blank_subplots():
    fig = plt.figure()
    gs = GridSpec(4, 6)
    ax1 = fig.add_subplot(gs[0, 1])
    ax1.plot(D['x1'], D['y1'])
    fig.add_subplot(gs[1, 1])
    fig.add_subplot(gs[2:, 1])
    fig.add_subplot(gs[0, 2:])
    fig.add_subplot(gs[1:3, 2:4])
    fig.add_subplot(gs[3, 2:5])
    fig.add_subplot(gs[1:3, 4:])
    fig.add_subplot(gs[3, 5])
    gs.update(hspace=.6, wspace=.6)
    renderer = run_fig(fig)

    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        d1, d2 = strip_dict_params(data_dict, BLANK_SUBPLOTS['data'][data_no],
                                   ignore=['uid'])
        equivalent, msg = compare_dict(d1, d2)

    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   BLANK_SUBPLOTS['layout'])
    assert equivalent, msg
Beispiel #25
0
def test_simple_scatter():
    fig, ax = plt.subplots()
    ax.scatter(D['x1'], D['y1'])
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        d1, d2 = strip_dict_params(data_dict, SIMPLE_SCATTER['data'][data_no], ignore=['uid'])
        print(d1)
        print('\n')
        print(d2)
        assert d1 == d2

    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   SIMPLE_SCATTER['layout'])
    assert equivalent, msg
def test_blank_subplots():
    fig = plt.figure()
    gs = GridSpec(4, 6)
    ax1 = fig.add_subplot(gs[0, 1])
    ax1.plot(D["x1"], D["y1"])
    fig.add_subplot(gs[1, 1])
    fig.add_subplot(gs[2:, 1])
    fig.add_subplot(gs[0, 2:])
    fig.add_subplot(gs[1:3, 2:4])
    fig.add_subplot(gs[3, 2:5])
    fig.add_subplot(gs[1:3, 4:])
    fig.add_subplot(gs[3, 5])
    gs.update(hspace=0.6, wspace=0.6)
    renderer = run_fig(fig)

    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        d1, d2 = strip_dict_params(data_dict,
                                   BLANK_SUBPLOTS["data"][data_no],
                                   ignore=["uid"])
        equivalent, msg = compare_dict(d1, d2)

    equivalent, msg = compare_dict(renderer.plotly_fig["layout"],
                                   BLANK_SUBPLOTS["layout"])
    assert equivalent, msg
Beispiel #27
0
def test_double_scatter():
    fig, ax = plt.subplots()
    ax.scatter(D['x1'], D['y1'], color='red', s=121, marker='^', alpha=0.5)
    ax.scatter(D['x2'], D['y2'], color='purple', s=64, marker='s', alpha=0.5)
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
        d1, d2 = strip_dict_params(data_dict, DOUBLE_SCATTER['data'][data_no], ignore=['uid'])
        print(d1)
        print('\n')
        print(d2)
        assert d1 == d2

    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   DOUBLE_SCATTER['layout'])
    assert equivalent, msg
Beispiel #28
0
def test_simple_scatter():
    fig, ax = plt.subplots()
    ax.scatter(D["x1"], D["y1"])
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        d1, d2 = strip_dict_params(data_dict,
                                   SIMPLE_SCATTER["data"][data_no],
                                   ignore=["uid"])
        print(d1)
        print("\n")
        print(d2)
        assert d1 == d2

    equivalent, msg = compare_dict(renderer.plotly_fig["layout"],
                                   SIMPLE_SCATTER["layout"])
    assert equivalent, msg
Beispiel #29
0
def test_blank_subplots():
    fig = plt.figure()
    gs = GridSpec(4, 6)
    ax1 = fig.add_subplot(gs[0, 1])
    ax1.plot(D['x1'], D['y1'])
    fig.add_subplot(gs[1, 1])
    fig.add_subplot(gs[2:, 1])
    fig.add_subplot(gs[0, 2:])
    fig.add_subplot(gs[1:3, 2:4])
    fig.add_subplot(gs[3, 2:5])
    fig.add_subplot(gs[1:3, 4:])
    fig.add_subplot(gs[3, 5])
    gs.update(hspace=.6, wspace=.6)
    renderer = run_fig(fig)
    equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
                                   BLANK_SUBPLOTS['layout'])
    assert equivalent, msg
Beispiel #30
0
def test_double_scatter():
    fig, ax = plt.subplots()
    ax.scatter(D["x1"], D["y1"], color="red", s=121, marker="^", alpha=0.5)
    ax.scatter(D["x2"], D["y2"], color="purple", s=64, marker="s", alpha=0.5)
    renderer = run_fig(fig)
    for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
        d1, d2 = strip_dict_params(data_dict,
                                   DOUBLE_SCATTER["data"][data_no],
                                   ignore=["uid"])
        print(d1)
        print("\n")
        print(d2)
        assert d1 == d2

    equivalent, msg = compare_dict(renderer.plotly_fig["layout"],
                                   DOUBLE_SCATTER["layout"])
    assert equivalent, msg
def test_strip_style():
    fig = Figure(
        data=Data([
            Scatter(
                x=[52698, 43117],
                y=[53, 31],
                mode='markers',
                name='North America',
                text=['United States', 'Canada'],
                marker=Marker(
                    color='rgb(164, 194, 244)',
                    size=12,
                    line=Line(
                        color='white',
                        width=0.5
                    )
                )
            ),
            Scatter(
                x=[39317, 37236, 35650, 30066, 29570, 27159, 23557, 21046, 18007],
                y=[33, 20, 13, 19, 27, 19, 49, 44, 38],
                mode='markers',
                name='Europe',
                text=['Germany', 'Britain', 'France', 'Spain', 'Italy', 'Czech Rep.', 'Greece', 'Poland'],
                marker=Marker(
                    color='rgb(255, 217, 102)',
                    size=12,
                    line=Line(
                        color='white',
                        width=0.5
                    )
                )
            ),
            Scatter(
                x=[42952, 37037, 33106, 17478, 9813, 5253, 4692, 3899],
                y=[23, 42, 54, 89, 14, 99, 93, 70],
                mode='markers',
                name='Asia/Pacific',
                text=['Australia', 'Japan', 'South Korea', 'Malaysia', 'China', 'Indonesia', 'Philippines', 'India'],
                marker=Marker(
                    color='rgb(234, 153, 153)',
                    size=12,
                    line=Line(
                        color='white',
                        width=0.5
                    )
                )
            ),
            Scatter(
                x=[19097, 18601, 15595, 13546, 12026, 7434, 5419],
                y=[43, 47, 56, 80, 86, 93, 80],
                mode='markers',
                name='Latin America',
                text=['Chile', 'Argentina', 'Mexico', 'Venezuela', 'Venezuela', 'El Salvador', 'Bolivia'],
                marker=Marker(
                    color='rgb(142, 124, 195)',
                    size=12,
                    line=Line(
                        color='white',
                        width=0.5
                    )
                )
            )
        ]),
        layout=Layout(
            title='Quarter 1 Growth',
            autosize=False,
            width=500,
            height=500,
            xaxis=XAxis(
                title='GDP per Capita',
                showgrid=False,
                zeroline=False
            ),
            yaxis=YAxis(
                title='Percent',
                showline=False
            ),
            margin=Margin(
                l=65,
                r=50,
                b=65,
                t=90
            )
        )
    )
    print(fig)
    print('\n\n')
    fig.strip_style()
    print(fig)
    print('\n\n')
    comp_fig = Figure(
        data=Data([
            Scatter(
                x=[52698, 43117],
                y=[53, 31],
                mode='markers',
                name='North America',
                text=['United States', 'Canada'],
                marker=Marker(
                    line=Line()
                )
            ),
            Scatter(
                x=[39317, 37236, 35650, 30066, 29570, 27159, 23557, 21046, 18007],
                y=[33, 20, 13, 19, 27, 19, 49, 44, 38],
                mode='markers',
                name='Europe',
                text=['Germany', 'Britain', 'France', 'Spain', 'Italy', 'Czech Rep.', 'Greece', 'Poland'],
                marker=Marker(
                    line=Line()
                )
            ),
            Scatter(
                x=[42952, 37037, 33106, 17478, 9813, 5253, 4692, 3899],
                y=[23, 42, 54, 89, 14, 99, 93, 70],
                mode='markers',
                name='Asia/Pacific',
                text=['Australia', 'Japan', 'South Korea', 'Malaysia', 'China', 'Indonesia', 'Philippines', 'India'],
                marker=Marker(
                    line=Line()
                )
            ),
            Scatter(
                x=[19097, 18601, 15595, 13546, 12026, 7434, 5419],
                y=[43, 47, 56, 80, 86, 93, 80],
                mode='markers',
                name='Latin America',
                text=['Chile', 'Argentina', 'Mexico', 'Venezuela', 'Venezuela', 'El Salvador', 'Bolivia'],
                marker=Marker(
                    line=Line()
                )
            )
        ]),
        layout=Layout(
            title='Quarter 1 Growth',
            width=500,
            height=500,
            xaxis=XAxis(
                title='GDP per Capita'
            ),
            yaxis=YAxis(
                title='Percent'
            ),
            margin=Margin(
                l=65,
                r=50,
                b=65,
                t=90
            )
        )
    )
    equivalent, msg = compare_dict(fig, comp_fig)
    print(msg)
    assert equivalent
def test_strip_style():
    fig = Figure(data=Data([
        Scatter(x=[52698, 43117],
                y=[53, 31],
                mode='markers',
                name='North America',
                text=['United States', 'Canada'],
                marker=Marker(color='rgb(164, 194, 244)',
                              size=12,
                              line=Line(color='white', width=0.5))),
        Scatter(
            x=[39317, 37236, 35650, 30066, 29570, 27159, 23557, 21046, 18007],
            y=[33, 20, 13, 19, 27, 19, 49, 44, 38],
            mode='markers',
            name='Europe',
            text=[
                'Germany', 'Britain', 'France', 'Spain', 'Italy', 'Czech Rep.',
                'Greece', 'Poland'
            ],
            marker=Marker(color='rgb(255, 217, 102)',
                          size=12,
                          line=Line(color='white', width=0.5))),
        Scatter(x=[42952, 37037, 33106, 17478, 9813, 5253, 4692, 3899],
                y=[23, 42, 54, 89, 14, 99, 93, 70],
                mode='markers',
                name='Asia/Pacific',
                text=[
                    'Australia', 'Japan', 'South Korea', 'Malaysia', 'China',
                    'Indonesia', 'Philippines', 'India'
                ],
                marker=Marker(color='rgb(234, 153, 153)',
                              size=12,
                              line=Line(color='white', width=0.5))),
        Scatter(x=[19097, 18601, 15595, 13546, 12026, 7434, 5419],
                y=[43, 47, 56, 80, 86, 93, 80],
                mode='markers',
                name='Latin America',
                text=[
                    'Chile', 'Argentina', 'Mexico', 'Venezuela', 'Venezuela',
                    'El Salvador', 'Bolivia'
                ],
                marker=Marker(color='rgb(142, 124, 195)',
                              size=12,
                              line=Line(color='white', width=0.5)))
    ]),
                 layout=Layout(title='Quarter 1 Growth',
                               autosize=False,
                               width=500,
                               height=500,
                               xaxis=XAxis(title='GDP per Capita',
                                           showgrid=False,
                                           zeroline=False),
                               yaxis=YAxis(title='Percent', showline=False),
                               margin=Margin(l=65, r=50, b=65, t=90)))
    print(fig)
    print('\n\n')
    fig.strip_style()
    print(fig)
    print('\n\n')
    comp_fig = Figure(data=Data([
        Scatter(x=[52698, 43117],
                y=[53, 31],
                mode='markers',
                name='North America',
                text=['United States', 'Canada'],
                marker=Marker(line=Line())),
        Scatter(
            x=[39317, 37236, 35650, 30066, 29570, 27159, 23557, 21046, 18007],
            y=[33, 20, 13, 19, 27, 19, 49, 44, 38],
            mode='markers',
            name='Europe',
            text=[
                'Germany', 'Britain', 'France', 'Spain', 'Italy', 'Czech Rep.',
                'Greece', 'Poland'
            ],
            marker=Marker(line=Line())),
        Scatter(x=[42952, 37037, 33106, 17478, 9813, 5253, 4692, 3899],
                y=[23, 42, 54, 89, 14, 99, 93, 70],
                mode='markers',
                name='Asia/Pacific',
                text=[
                    'Australia', 'Japan', 'South Korea', 'Malaysia', 'China',
                    'Indonesia', 'Philippines', 'India'
                ],
                marker=Marker(line=Line())),
        Scatter(x=[19097, 18601, 15595, 13546, 12026, 7434, 5419],
                y=[43, 47, 56, 80, 86, 93, 80],
                mode='markers',
                name='Latin America',
                text=[
                    'Chile', 'Argentina', 'Mexico', 'Venezuela', 'Venezuela',
                    'El Salvador', 'Bolivia'
                ],
                marker=Marker(line=Line()))
    ]),
                      layout=Layout(title='Quarter 1 Growth',
                                    width=500,
                                    height=500,
                                    xaxis=XAxis(title='GDP per Capita'),
                                    yaxis=YAxis(title='Percent'),
                                    margin=Margin(l=65, r=50, b=65, t=90)))
    equivalent, msg = compare_dict(fig, comp_fig)
    print(msg)
    assert equivalent