occasionalUser
occasionalUser

Reputation: 59

How to Overlay fitted distribution and histogram using JFreeChart?

I am using the SSJ Library (which makes use of JFreeChart for drawing graphs) to fit distributions to data (Weibull, Gamma, etc ...) using maximum likelihood estimates. After fitting the distributions, I would like to graph the histogram together with the fitted density curve. I know how to get a histogram using HistogramChart and I know how to get a graph of the fitted density using ContinuousDistChart. The problem is, how do I overlay the two on a single plot? The HistogramChart class has methods to access the underlying JFreeChart; however, the ContinuousDistChart does not. Is it possible to do this with JFreeChart?

Upvotes: 2

Views: 1006

Answers (1)

trashgod
trashgod

Reputation: 205875

If the JFrame returned by methods in umontreal.iro.lecuyer.charts.ContinuousDistChart is actually an org.jfree.chart.ChartFrame, you can cast and use getChartPanel() to drill down. There's an example here.

Upvotes: 2

Related Questions