changed arithmetic mean to median in fill polygon