BruceJohnJennerLawso / scrap

Hockey stats analysis done by scraping the data to a csv file, then processing/analyzing them with more python.
3 stars 0 forks source link

Make the scatter & histogram functions smartly pick a good interval to snap to #120

Closed BruceJohnJennerLawso closed 7 years ago

BruceJohnJennerLawso commented 7 years ago

Currently the snap to parts of the graphing code are automatically set to go for the x axis nearest 10, and the y axis nearest 5. This is not a great solution, because, for example here

pgdt_by_diffqualitymargin

the choice of 10 & 5 is too big compared to the range of the data, leaving a lot of the graph space unused, and making it hard to see the data points. One way of fixing this would be to make the plotter start at something like 10, then do its whole bounds snapping thing, then check if the span of the data is under some pct of the bounds span (say 80%?), if it is, try to drop it down from 10 to 5, from 5 to 2, from 2 to 1, from 1 to 0.5, and so on, until we get a fit that both covers the entire span of the data, and has bounds that snugly fit the data, while still snapping to a clean integer value.

BruceJohnJennerLawso commented 7 years ago

This could be a reasonable fix for #47 without needing to modify the marker size

BruceJohnJennerLawso commented 7 years ago

Pretty much done this as of 5e0805ac3d935cd1cdc38b399a3bd94a2232727d, although on second thought I may do the marker scaling after all