How would I create a JFreeChart scatterplot best fit line

前端 未结 1 421
梦如初夏
梦如初夏 2021-01-22 09:27

I have an arraylist of points I want to include in a JFreeChart scatterplot. That works fine, but I now want a best fit line on it. After some searching, JFreeChart doesn\'t sup

相关标签:
1条回答
  • 2021-01-22 10:23

    Use the built-in Regression method getOLSRegression() or a statistical library such as Apache Commons Math to determine the slope and intercept of such a line using simple regression. Add your original data to a scatter plot, as shown here. Add an XYLineAnnotation representing the endpoints of your line, as shown here.

    0 讨论(0)
提交回复
热议问题