brettonw / plot-svg.js

A simple javascript package to plot pretty graphs from arrays of {x:"x", y:"y"} pairs.
http://plot-svg.azurewebsites.net/
MIT License
1 stars 0 forks source link

Ignore points with extreme coordinates when determining plotting area #3

Open Schnark opened 7 years ago

Schnark commented 7 years ago

Currently, the plotting area is set to include all given points. This is a bit problematic when there are points with extreme coordinates, e.g. when you want to plot the function 1/x. It would be nice if the library would detect such points (some methods are listed in https://en.wikipedia.org/wiki/Outlier#Detection) and ignore them when determining the plotting area and when plotting points/lines.

brettonw commented 7 years ago

The library itself is meant to plot the points given, and it would not be appropriate to have this library making decisions about which points to include or not. I can see two possible solutions: 1) Add a layer that does the analysis you are talking about. Pro - you get the desired behavior, con, the library renders by interpolation, so removing points arbitrarily could change the shape of the plot. 2) Add a control to define the plot region, both in x and y. I'll consider the latter as a feature request linked to the pan/zoom option.