Calculate beta distribution and drawing (2), calculate beta distribution drawing
Import java. awt. font; import java. awt. gridLayout; import java. io. bufferedReader; import java. io. fileReader; import java. io. IOException; import javax. swing. JFrame; import org. jfree. chart. chartFactory; import org. jfree. chart. chartPanel; import org. jfree. chart. JFreeChart; import org. jfree. chart. axis. numberAxis; import org. jfree. chart. plot. categoryPlot; import org. jfree. chart. plot. plotOrientation; import org. jfree. Data. category. categoryDataset; import org. jfree. data. category. defaultCategoryDataset; import zxy. nlp. lda. conf. pathConfig; public class plotbetadis {ChartPanel frame1; public plotbetadis () throws IOException {defacategorydataset dataset = (DefaultCategoryDataset) createDataset (); JFreeChart chart = ChartFactory. createLineChart ("", "date", "topic intensity/%", dataset, PlotOrientation. VERTICAL, true, True, true); CategoryPlot plot = chart. getCategoryPlot (); NumberAxis numberaxis = (NumberAxis) plot. getRangeAxis (); numberaxis. setStandardTickUnits (NumberAxis. createIntegerTickUnits (); numberaxis. setLabelFont (new Font ("", Font. BOLD, 14); // horizontal bottom heading numberaxis. setTickLabelFont (new Font ("", Font. BOLD, 12); // vertical title frame1 = new ChartPanel (chart, true); chart. getLegend (). setItemFont (new Font ("", Font. BOL D, 15); chart. getTitle (). setFont (new Font ("", Font. BOLD, 20); // set the title Font} private static CategoryDataset createDataset () throws IOException {defacategcategorydataset = new DefaultCategoryDataset (); int lnum = 2; String resPath = PathConfig. ldaResultsPath; String modelName = "ldatimes"; FileReader fr = new FileReader (filename); double [] [] nodes = new double [lnum] []; String [] lines; // System. out. println ("read the file content in the unit of action, one read for the whole row at a time:"); BufferedReader br = new BufferedReader (fr); String line = null; int x = 0; // read a row at a time until null is the end of the file while (line = br. readLine ())! = Null & x <lnum) {// display the row number // System. out. println ("line" + lnum + ":" + line); lines = line. split ("\ t"); // for (int I = 0; I <lines. length; I ++) {// System. out. println ("one-dimensional:" + lines [I] + ""); //} nodes [x] = new double [lines. length]; for (int y = 0; y <lines. length; y ++) {nodes [x] [y] = Double. parseDouble (lines [y]); String s = String. valueOf (y + 4)/4); String t = String. valueOf (x); defaultcategorydataset. addValue (nodes [x] [y], "top" + t, s) ;}x ++; // lines = null ;}br. close (); return defadefacategorydataset;} public ChartPanel getChartPanel () {return frame1;} public static void main (String args []) throws IOException {JFrame frame = new JFrame ("Data Statistics"); frame. setLayout (new GridLayout (2, 2, 5); frame. add (new plotbetadis (). getChartPanel (); // Add a line chart frame. setBounds (50, 50,600,600); frame. setVisible (true );}}