can i plot a statistics histogram?for instance:

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
dafuh
Posts: 2
Joined: Thu Dec 23, 2004 6:26 am

can i plot a statistics histogram?for instance:

Post by dafuh » Thu Dec 23, 2004 7:15 am

i want to plot a chart similar to the graph below,
i can plot a curve and a histogram separately in two images,but i do not know how integrate a normal curve with a histogram into a image
what should i do?
Image

angel
Posts: 899
Joined: Thu Jan 15, 2004 12:07 am
Location: Germany - Palatinate

Post by angel » Thu Dec 23, 2004 8:18 am

Add a second renderer to you chart.

jelaiw
Posts: 6
Joined: Sat Jul 05, 2003 8:40 pm

Post by jelaiw » Fri Dec 31, 2004 7:17 pm

This link is an example of an overlaid plot I did with a histogram and a probability density function from a t-distribution.

http://www.soph.uab.edu/images/ssg_imag ... esPlot.JPG (sorry for the poor quality, need to update this image)

There should be some examples of how specifically to do an overlaid plot in the JFreeChart demos, it's fairly easy, and as angel suggests, it reduces down to adding renderers.

To draw a curve, you probably need to be looking at Function2D and DatasetUtilities.sampleFunction2D. This doesn't actually draw the curve as a line; I actually ended up sampling and plotting enough points from the function so that it looks like a curve. Not ideal, but I haven't figured out a better way in JFreeChart yet.

Hope this helps.

jelaiw
Posts: 6
Joined: Sat Jul 05, 2003 8:40 pm

Post by jelaiw » Fri Dec 31, 2004 7:31 pm

This thread also covers this topic in a bit more detail. http://www.jfree.org/phpBB2/viewtopic.p ... =histogram

Perhaps you should try the forum search function, at a glance there were at least a half dozen topics about drawing curves over histograms. :-)

curiousmind

histogram

Post by curiousmind » Sat Jun 25, 2005 10:20 am

jelaiw wrote:This thread also covers this topic in a bit more detail. http://www.jfree.org/phpBB2/viewtopic.p ... =histogram

Perhaps you should try the forum search function, at a glance there were at least a half dozen topics about drawing curves over histograms. :-)
Hi Jelaiw

Can you please provide code for creating histogram and adding curve to it.

Thanks

Locked