File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ ``` java
2
+
3
+ import javax.swing.* ;
4
+
5
+ import org.math.plot.* ;
6
+
7
+ import static org.math.array.StatisticSample.* ;
8
+
9
+ public class HistogramExample {
10
+ public static void main (String [] args ) {
11
+
12
+ // define your data
13
+ double [] x = randomLogNormal(1000 , 0 , 0.5 ); // 1000 random numbers from a log normal statistical law
14
+
15
+ // create your PlotPanel (you can use it as a JPanel)
16
+ Plot2DPanel plot = new Plot2DPanel ();
17
+
18
+ // add the histogram (50 slices) of x to the PlotPanel
19
+ plot. addHistogramPlot(" Log Normal population" , x, 50 );
20
+
21
+ // put the PlotPanel in a JFrame like a JPanel
22
+ JFrame frame = new JFrame (" a plot panel" );
23
+ frame. setSize(600 , 600 );
24
+ frame. setContentPane(plot);
25
+ frame. setVisible(true );
26
+
27
+ }
28
+ }
29
+
30
+ ```
You can’t perform that action at this time.
0 commit comments