![]() |
mpl_toolkits.basemap - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: mpl_toolkits.basemap (/thread-40368.html) |
mpl_toolkits.basemap - rf_kartal - Jul-18-2023 Hello everyone, I hope everything is very good. I am reading the shapefile and creating a map with the help of mpl_toolkits.basemap library. In this file, there are many polygons with city boundaries, but also city names. I had the polygons drawn, but I could not overwrite the city names. How can I do this, can you please help? I want to include scales in the map. Do you get the following error while doing this? "ValueError: cannot draw map scale for projection='cyl'" m = Basemap(projection='cyl', llcrnrlat=39.2872, llcrnrlon=26.4942, urcrnrlat=41.8215, urcrnrlon=30.1232, resolution='h') m.drawcoastlines(linewidth=.5, color='#666666') m.drawcountries(linewidth=1, color='#990000') m.drawparallels(np.arange(32, 45, 1), labels=[1, 0, 0, 0], linewidth=0.05) m.fillcontinents(color='#FFFFFF', lake_color='lightblue') m.drawmapboundary(fill_color='lightblue') m.drawmeridians(np.arange(23, 48, 1), labels=[0, 0, 0, 1], linewidth=0.05) m.readshapefile(myshp, 'Watersheds', linewidth=1, default_encoding='latin-1', color='#CC3300') m.readshapefile(shapefile=city_shp, name='Watersheds', linewidth=0.2, default_encoding='latin-1', color='#808080') m.drawmapscale(lon=23, lat=32, lon0=48, lat0=45, units='km', length=100, barstyle='fancy', labelstyle='simple') |