Esempio n. 1
0
def test_gridliner_specified_lines():
    xs = [0, 60, 120, 180, 240, 360]
    ys = [-90, -60, -30, 0, 30, 60, 90]
    ax = mock.Mock(_gridliners=[], spec=GeoAxes)
    gl = GeoAxes.gridlines(ax, xlocs=xs, ylocs=ys)
    assert isinstance(gl.xlocator, mticker.FixedLocator)
    assert isinstance(gl.ylocator, mticker.FixedLocator)
    assert gl.xlocator.tick_values(None, None).tolist() == xs
    assert gl.ylocator.tick_values(None, None).tolist() == ys
Esempio n. 2
0
def test_gridliner_specified_lines():
    xs = [0, 60, 120, 180, 240, 360]
    ys = [-90, -60, -30, 0, 30, 60, 90]
    ax = mock.Mock(_gridliners=[], spec=GeoAxes)
    gl = GeoAxes.gridlines(ax, xlocs=xs, ylocs=ys)
    assert isinstance(gl.xlocator, mticker.FixedLocator)
    assert isinstance(gl.ylocator, mticker.FixedLocator)
    assert gl.xlocator.tick_values(None, None).tolist() == xs
    assert gl.ylocator.tick_values(None, None).tolist() == ys
Esempio n. 3
0
def test_gridliner_specified_lines():
    meridians = [0, 60, 120, 180, 240, 360]
    parallels = [-90, -60, -30, 0, 30, 60, 90]

    ax = plt.subplot(1, 1, 1, projection=ccrs.PlateCarree())
    gl = GeoAxes.gridlines(ax, xlocs=meridians, ylocs=parallels)
    assert isinstance(gl.xlocator, mticker.FixedLocator)
    assert isinstance(gl.ylocator, mticker.FixedLocator)
    assert gl.xlocator.tick_values(None, None).tolist() == meridians
    assert gl.ylocator.tick_values(None, None).tolist() == parallels
Esempio n. 4
0
def test_gridliner_specified_lines():
    meridians = [0, 60, 120, 180, 240, 360]
    parallels = [-90, -60, -30, 0, 30, 60, 90]

    def mpl_connext(*args):
        pass

    canvas = mock.Mock(mpl_connext=mpl_connext)
    fig = mock.Mock(spec=matplotlib.figure.Figure, canvas=canvas)
    ax = mock.Mock(_gridliners=[], spec=GeoAxes, figure=fig)
    gl = GeoAxes.gridlines(ax, xlocs=meridians, ylocs=parallels)
    assert isinstance(gl.xlocator, mticker.FixedLocator)
    assert isinstance(gl.ylocator, mticker.FixedLocator)
    assert gl.xlocator.tick_values(None, None).tolist() == meridians
    assert gl.ylocator.tick_values(None, None).tolist() == parallels