matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
778 stars 392 forks source link

The Basemap.drawcounties method does not use the 'antialiased' parameter #501

Closed TheFizzWare closed 10 months ago

TheFizzWare commented 4 years ago

Current method:

def drawcounties(self,linewidth=0.1,linestyle='solid',color='k',antialiased=1, facecolor='none',ax=None,zorder=None,drawbounds=False):
    """
    Draw county boundaries in US. The county boundary shapefile
    originates with the NOAA Coastal Geospatial Data Project
    (http://coastalgeospatial.noaa.gov/data_gis.html).

    .. tabularcolumns:: |l|L|

    ==============   ====================================================
    Keyword          Description
    ==============   ====================================================
    linewidth        county boundary line width (default 0.1)
    linestyle        coastline linestyle (default solid)
    color            county boundary line color (default black)
    facecolor        fill color of county (default is no fill)
    antialiased      antialiasing switch for county boundaries
                     (default True).
    ax               axes instance (overrides default axes instance)
    zorder           sets the zorder for the county boundaries (if not
                     specified, uses default zorder for
                     matplotlib.patches.LineCollections).
    ==============   ====================================================

    returns a matplotlib.patches.LineCollection object.
    """
    ax = ax or self._check_ax()
    gis_file = os.path.join(basemap_datadir,'UScounties')
    county_info = self.readshapefile(gis_file,'counties',\
                  default_encoding='latin-1',drawbounds=drawbounds)
    counties = [coords for coords in self.counties]
    counties = PolyCollection(counties)
    counties.set_linestyle(linestyle)
    counties.set_linewidth(linewidth)
    counties.set_edgecolor(color)
    counties.set_facecolor(facecolor)
    counties.set_label('counties')
    if zorder:
        counties.set_zorder(zorder)
    ax.add_collection(counties)
    return counties

Suggested revision: Replace counties = PolyCollection(... instantiation line with counties = PolyCollection(counties, antialiaseds=(antialiased,))

molinav commented 10 months ago

I am closing the issue as complete, since the patch has been pushed to the repository targeting the hotfix 1.3.9. Thanks!