Esempio n. 1
0
def test_declarative_colorbar_fontsize():
    """Test adjusting the font size of a colorbar."""
    data = xr.open_dataset(get_test_data('GFS_test.nc', as_file_obj=False))

    cfill = FilledContourPlot()
    cfill.data = data
    cfill.field = 'Temperature_isobaric'
    cfill.level = 300 * units.hPa
    cfill.time = datetime(2010, 10, 26, 12)
    cfill.contours = list(range(210, 250, 2))
    cfill.colormap = 'BuPu'
    cfill.colorbar = 'horizontal'
    cfill.colorbar_fontsize = 'x-small'

    panel = MapPanel()
    panel.area = (-124, -72, 20, 53)
    panel.projection = 'lcc'
    panel.layers = ['coastline', 'borders', 'usstates']
    panel.plots = [cfill]

    pc = PanelContainer()
    pc.size = (8, 8)
    pc.panels = [panel]
    pc.draw()

    return pc.figure
Esempio n. 2
0
def test_colorfill_no_colorbar(cfeature):
    """Test that we can use ContourFillPlot."""
    data = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))

    contour = FilledContourPlot()
    contour.data = data
    contour.level = 700 * units.hPa
    contour.field = 'Temperature'
    contour.colormap = 'coolwarm'
    contour.colorbar = None

    panel = MapPanel()
    panel.area = (-110, -60, 25, 55)
    panel.layers = [cfeature.STATES]
    panel.plots = [contour]

    pc = PanelContainer()
    pc.panel = panel
    pc.size = (8, 8)
    pc.draw()

    return pc.figure