windrose
windrose copied to clipboard
Change 'inf' label in legend
inf label in the legend is not appropriate on most of the occasions. Instead of that, a greater than (>) symbol can be added to the maximum value.
legend labels [0.0 : 2.0 ) [2.0 : 4.0 ) [4.0 : 6.0 ) [6.0 : inf )
from this to this [0.0 : 2.0 ) [2.0 : 4.0 ) [4.0 : 6.0 ) >6.0
Change https://github.com/python-windrose/windrose/blob/b602213d9d6250d9e6eebaa7ac992fe9b6ec1b7a/windrose/windrose.py#L215-L230
to
def get_labels(decimal_places=1, units=None):
_decimal_places = str(decimal_places)
fmt = "[%." + _decimal_places + "f " + ": %0." + _decimal_places + "f"
labels = np.copy(self._info["bins"])
labels[-1] = np.nan
last_dig = labels[-2]
if locale.getlocale()[0] in ["fr_FR"]:
fmt += "["
else:
fmt += ")"
if units:
fmt += ' ' + units
labels = [fmt % (labels[i], labels[i + 1]) for i in range(len(labels) - 1)]
print(labels)
labels[-1] = '>'+str(last_dig)
return labels

I am having this issue as well. Is there a plan to introduce this fix for the windrose legend?
@sampr7 your fix looks OK to me. Do you want to send a PR?
@sampr7 your fix looks OK to me. Do you want to send a PR?
@ocefpaf Sure. Will do
Thanks @sampr7! We merged #185 and I'll prepare a new release soon.