Skip to content

norm the histogram [legendgram] #252

Open
@ljwolf

Description

@ljwolf

the histogram should be normalized to 0,1 rather letting it take the default values in frequency-space.

this keeps the interaction style the same between stating how big the legendgram is and then working with it later, like if someone wants to, like, add an analytical element to the legend, it'd be easier to work with if we just made the y-axis forced to be 0,1 rather than unknown since it's not displayed. Right now, you can use the legendgram's transAxes to work with it like its y-axis is 0,1, though.

ax = gdf.plot("GI89")
gpd.GeoDataFrame(gdf.iloc[2255].to_frame().T).plot('GI89', linewidth=2, edgecolor='r', ax=ax)
ax.axis('off')
hax = legendgram(plt.gcf(), # grab the figure, we need it
           ax, # the axis to add the legend
           gdf.GI89, # the attribute to map
           np.percentile(gdf.GI89, np.arange(10,110,10)), # the breaks to induce color differences on
           mplpal.Viridis_10, # the palette to use,
           legend_size=(.5,.16), # the size of the subplot, in fractions of the original axis
           loc= 'lower left', # the location on the axis
           clip=(.3,.5) # bounds to clip the view of the histogram
          )
hax.vlines(gdf.iloc[2255].GI89,0,1,color='r', transform=hax.transAxes)

download

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions