예제 #1
0
colorbar_style = lbm.ColorbarStyle(title="Rake",
                                   format="%s",
                                   ticks=None,
                                   spacing="proportional")
thematic_color = lbm.ThematicStyleRanges(
    [-180, -135, -45, 45, 135, 180],
    ['yellow', "green", "yellow", "red", "yellow"],
    value_key="rake",
    colorbar_style=colorbar_style)
#thematic_color = lbm.ThematicStyleGradient([-180, -90, 0, 90, 180], ['yellow', "green", "yellow", "red", "yellow"], labels=["RL", "Nf", "LL", "Tf", "RL"], value_key="rake", colorbar_style=colorbar_style)
thematic_legend_style = None

focmec_style = lbm.FocmecStyle(size=thematic_size,
                               fill_color=thematic_color,
                               thematic_legend_style=thematic_legend_style)
layer = lbm.MapLayer(focmec_data, focmec_style)
layers.append(layer)

legend_style = lbm.LegendStyle(location=1)
title_style = lbm.DefaultTitleTextStyle
title_style.weight = "bold"
map = lbm.LayeredBasemap(layers,
                         title,
                         projection,
                         region=region,
                         title_style=title_style,
                         graticule_interval=graticule_interval,
                         resolution=resolution,
                         legend_style=legend_style)
map.plot(fig_filespec=fig_filespec)
예제 #2
0
#layers.append(layer)

## ROB earthquake catalog
catalog = seismodb.query_local_eq_catalog(region=region, start_date=1350)
values = {}
values['magnitude'] = catalog.get_magnitudes()
values['depth'] = catalog.get_depths()
values['year'] = [eq.year for eq in catalog]
point_data = lbm.MultiPointData(catalog.get_longitudes(),
                                catalog.get_latitudes(),
                                values=values)

legend_label_style = lbm.TextStyle(font_size=10)
thematic_legend_style = lbm.LegendStyle(title="Magnitude",
                                        location=3,
                                        shadow=True,
                                        label_style=legend_label_style,
                                        fancy_box=True,
                                        label_spacing=0.7)
thematic_size = lbm.ThematicStyleGradient([1, 3, 5, 6.3], [1, 4, 10, 15],
                                          labels=["1.0", "3.0", "5.0", "6.3"],
                                          value_key="magnitude")

## Color scale for depth
#colorbar_style = lbm.ColorbarStyle(title="Depth (km)", location="bottom", format="%d", label_size=18, tick_label_size=18)
#thematic_color = lbm.ThematicStyleColormap(value_key="depth")
#thematic_color = lbm.ThematicStyleRanges([0,1,10,25,50], ['red', 'orange', 'yellow', 'green'], value_key="depth", colorbar_style=colorbar_style)

## Color scale for time
## Discontinuous color scale
#cb_title = u"Jaar - Année - Year"
cb_title = "Year"
예제 #3
0
layers = []

joined_attributes = {}
joined_attributes[attribute] = {
    'key': 'ID_ROB',
    'values': {rec['id']: rec[attribute]
               for rec in db_records}
}

## Commune layer
gis_data = lbm.GisData(gis_filespec, joined_attributes=joined_attributes)
if attribute == "language":
    tsi = lbm.ThematicStyleIndividual(["FR", "NL", "DE"], ['r', 'y', 'b'],
                                      value_key=attribute)
    thematic_legend_style = lbm.LegendStyle(title=attribute, location=3)
elif attribute == "id_province":
    tsi = lbm.ThematicStyleGradient(values=[1, 6, 11],
                                    styles=["r", "g", "b"],
                                    value_key=attribute)
    thematic_legend_style = None
    colorbar_style = lbm.ColorbarStyle(title=attribute,
                                       ticks=range(1, 11),
                                       spacing="proportional")
    tsi.colorbar_style = colorbar_style
elif attribute == "id_main":
    values = joined_attributes[attribute]['values'].values()
    vmin, vmax = np.min(values), np.max(values)
    tsi = lbm.ThematicStyleColormap(value_key=attribute, vmin=vmin, vmax=vmax)
    thematic_legend_style = None
    colorbar_style = lbm.ColorbarStyle(title=attribute)