![]() ![]() no rivers) return polygons_to_traces ( poly_paths, N_poly ) # Function generating country lon/lat traces def get_country_traces (): poly_paths = m. get_paths () # coastline polygon paths N_poly = 91 # use only the 91st biggest coastlines (i.e. append ( make_scatter ( lon_cc, lat_cc )) return traces # Function generating coastline lon/lat traces def get_coastline_traces (): poly_paths = m. iter_segments ( simplify = False )] ) # convert coordinates to lon/lat by 'inverting' the Basemap projection lon_cc, lat_cc = m ( coords_cc, coords_cc, inverse = True ) # add plot.ly plotting options traces. ![]() ![]() array (, vertex ) for ( vertex, code ) in poly_path. plotting list for i_poly in range ( N_poly ): poly_path = poly_paths # get the Basemap coordinates of each segment coords_cc = np. It’s a matplotlib extension, so it has got all its features to create data visualizations, and adds the geographical projections and some datasets to be able to plot coast lines, countries, and so on directly from the library. (N_poly): number of polygon to convert ''' traces = # init. Basemap is a great tool for creating maps using python in a simple way. (poly_paths): paths to polygons pos arg 2. # Make shortcut to Basemap object, # not specifying projection type for this example m = Basemap () # Make trace-generating function (return a Scatter object) def make_scatter ( x, y ): return Scatter ( x = x, y = y, mode = 'lines', line = Line ( color = "black" ), name = ' ' # no name on hover ) # Functions converting coastline/country polygons to lon/lat traces def polygons_to_traces ( poly_paths, N_poly ): ''' pos arg 1. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |