本文整理汇总了Java中org.math.plot.Plot3DPanel.addScatterPlot方法的典型用法代码示例。如果您正苦于以下问题:Java Plot3DPanel.addScatterPlot方法的具体用法?Java Plot3DPanel.addScatterPlot怎么用?Java Plot3DPanel.addScatterPlot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.math.plot.Plot3DPanel
的用法示例。
在下文中一共展示了Plot3DPanel.addScatterPlot方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.math.plot.Plot3DPanel; //导入方法依赖的package包/类
public static void main(String[] args) {
Plot3DPanel p = new Plot3DPanel();
Object[][] XYZ = new Object[8][3];
Object[][] XYZ2 = new Object[10][3];
for (int j = 0; j < XYZ.length; j++) {
XYZ[j][0] = Math.random();
XYZ[j][1] = Math.random();
XYZ[j][2] = "" + ((char) ('a' + j));
}
for (int j = 0; j < XYZ2.length; j++) {
XYZ2[j][0] = Math.random();
XYZ2[j][1] = Math.random();
XYZ2[j][2] = "" + ((char) ('a' + j));
}
p.addScatterPlot("toto", p.mapData(XYZ));
p.addScatterPlot("toti", p.mapData(XYZ2));
p.setAxisScale(1, "log");
new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
HashMap<String, Double> arg = p.getAxis(2).getStringMap();
Collection<Double> ouch = arg.values();
Iterator<Double> it = ouch.iterator();
while (it.hasNext()) {
System.out.println(it.next());
}
}
示例2: plot3D
import org.math.plot.Plot3DPanel; //导入方法依赖的package包/类
public static synchronized void plot3D(double[][] plotData, MetricProperties properties, String group, String plotNames, String plotNameHandlers, String colorNames, String typePlots, boolean threeD) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
if (threeD) {
String plotName = ((plotNames!=null)?plotNames:"defaultPlotName");
String plotNameHandler = ((plotNameHandlers!=null)?plotNameHandlers:"defaultPlotNameHandler");
Plot3DPanel plot = properties.get3DPlots().get(plotName);
if (plot!=null) {
Color color = null;
String colorName = ((colorNames!=null)?colorNames:"red");
color = properties.getColors().get(colorName);
int plotHandler = 0;
if (DeploymentMetricProperties.getDeploymentMetricProperties().getDeploymentInternalParameters(group).getPlotHandlerStore().get(plotName) != null) {
if (DeploymentMetricProperties.getDeploymentMetricProperties().getDeploymentInternalParameters(group).getPlotHandlerStore().get(plotName).get(plotNameHandler) == null) {
plotHandler = DeploymentMetricProperties.getDeploymentMetricProperties().getDeploymentInternalParameters(group).getMaxPlotHandler(plotName) + 1;
} else {
plotHandler = DeploymentMetricProperties.getDeploymentMetricProperties().getDeploymentInternalParameters(group).getPlotHandlerStore().get(plotName).get(plotNameHandler);
}
} else {
DeploymentMetricProperties.getDeploymentMetricProperties().getDeploymentInternalParameters(group).putPlotHandlerStore(plotName, new HashMap<String,Integer>());
}
String typePlot = ((typePlots!=null)?typePlots:"line");
int plotHandler2 = 0;
Plot3DPanel plot2 = new Plot3DPanel();
if (color != null) {
if (typePlot.compareTo("box") == 0) {
plotHandler2 = plot2.addBoxPlot(plotNameHandler, color, plotData);
} else if (typePlot.compareTo("scatter") == 0) {
plotHandler2 = plot2.addScatterPlot(plotNameHandler, color, plotData);
} else if (typePlot.compareTo("grid") == 0) {
plotHandler2 = plot2.addGridPlot(plotNameHandler, color, increment(0, 1, plotData.length), increment(0, 1, plotData[0].length), plotData);
} else if (typePlot.compareTo("histogram") == 0) {
plotHandler2 = plot2.addHistogramPlot(plotNameHandler, color, plotData);
} else {
plotHandler2 = plot2.addLinePlot(plotNameHandler, color, plotData);
}
} else {
if (typePlot.compareTo("box") == 0) {
plotHandler2 = plot2.addBoxPlot(plotNameHandler, plotData);
} else if (typePlot.compareTo("scatter") == 0) {
plotHandler2 = plot2.addScatterPlot(plotNameHandler, plotData);
} else if (typePlot.compareTo("grid") == 0) {
plotHandler2 = plot2.addGridPlot(plotName, increment(0, 1, plotData.length), increment(0, 1, plotData[0].length), plotData);
} else if (typePlot.compareTo("histogram") == 0) {
plotHandler2 = plot2.addHistogramPlot(plotNameHandler, plotData);
} else {
plotHandler2 = plot2.addLinePlot(plotNameHandler, plotData);
}
}
if (plot.plotCanvas.getPlots().size()==0)
plot.addPlot(plot2.getPlot(plotHandler2));
else {
if (plotHandler < plot.plotCanvas.getPlots().size())
plot.setPlot(plotHandler, plot2.getPlot(plotHandler2));
else
plot.addPlot(plot2.getPlot(plotHandler2));
}
plot.setAutoBounds();
plot.repaint();
DeploymentMetricProperties.getDeploymentMetricProperties().getDeploymentInternalParameters(group).getPlotHandlerStore().get(plotName).put(plotNameHandler, plotHandler);
}
}
}
示例3: main
import org.math.plot.Plot3DPanel; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
double[][] data = {
{0, 2, 3, 4},
{2, 0, 4, 5},
{3, 4.1, 5, 6},
{2, 7, 1, 6}
};
RealMatrix X = new BlockRealMatrix(data);
/*int n = 20;
int p = 10;
X = rand(p, n);*/
int r = 3;
RealMatrix R = KernelPCA.run(X, r);
disp("Original Data:");
disp(X);
disp("Reduced Data:");
disp(R);
double[] x = R.getRow(0);
double[] y = R.getRow(1);
double[] z = R.getRow(2);
// create your PlotPanel (you can use it as a JPanel)
Plot2DPanel plot = new Plot2DPanel();
// add a line plot to the PlotPanel
// plot.addLinePlot("my plot", Color.RED, x, y);
// add a scatter plot to the PlotPanel
plot.addScatterPlot("KernelPCA", Color.RED, x, y);
plot.addLegend("North");
plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame = new JFrame("A 2D Plot Panel");
frame.setContentPane(plot);
frame.setBounds(100, 100, 500, 500);
frame.setVisible(true);
Plot3DPanel plot3D = new Plot3DPanel();
plot3D.addScatterPlot("KernelPCA", Color.RED, x, y, z);
plot3D.addLegend("North");
plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame3D = new JFrame("A 3D Plot Panel");
frame3D.setContentPane(plot3D);
frame3D.setBounds(100, 100, 500, 500);
frame3D.setVisible(true);
}
示例4: main
import org.math.plot.Plot3DPanel; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
double[][] data = {{0, 2, 3, 4}, {2, 0, 4, 5}, {3, 4.1, 5, 6}, {2, 7, 1, 6}};
RealMatrix X = new BlockRealMatrix(data);
/*int n = 20;
int p = 10;
X = rand(p, n);*/
int K = 3;
int r = 3;
RealMatrix R = LLE.run(X, K, r);
disp("Original Data:");
disp(X);
disp("Reduced Data:");
disp(R);
double[] x = R.getRow(0);
double[] y = R.getRow(1);
double[] z = R.getRow(2);
// create your PlotPanel (you can use it as a JPanel)
Plot2DPanel plot = new Plot2DPanel();
// add a line plot to the PlotPanel
// plot.addLinePlot("my plot", Color.RED, x, y);
// add a scatter plot to the PlotPanel
plot.addScatterPlot("LLE", Color.RED, x, y);
plot.addLegend("North");
/*plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");*/
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame = new JFrame("A 2D Plot Panel");
frame.setContentPane(plot);
frame.setBounds(100, 100, 500, 500);
frame.setVisible(true);
Plot3DPanel plot3D = new Plot3DPanel();
plot3D.addScatterPlot("LLE", Color.RED, x, y, z);
plot3D.addLegend("North");
/*plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");*/
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame3D = new JFrame("A 3D Plot Panel");
frame3D.setContentPane(plot3D);
frame3D.setBounds(100, 100, 500, 500);
frame3D.setVisible(true);
}
示例5: main
import org.math.plot.Plot3DPanel; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
double[][] data = {{0, 2, 3, 4}, {2, 0, 4, 5}, {3, 4.1, 5, 6}, {2, 7, 1, 6}};
RealMatrix X = new BlockRealMatrix(data);
/*int n = 20;
int p = 10;
X = rand(p, n);*/
int r = 3;
RealMatrix R = PCA.run(X, r);
disp("Original Data:");
disp(X);
disp("Reduced Data:");
disp(R);
double[] x = R.getRow(0);
double[] y = R.getRow(1);
double[] z = R.getRow(2);
// create your PlotPanel (you can use it as a JPanel)
Plot2DPanel plot = new Plot2DPanel();
// add a line plot to the PlotPanel
// plot.addLinePlot("my plot", Color.RED, x, y);
// add a scatter plot to the PlotPanel
plot.addScatterPlot("PCA", Color.RED, x, y);
plot.addLegend("North");
/*plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");*/
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame = new JFrame("A 2D Plot Panel");
frame.setContentPane(plot);
frame.setBounds(100, 100, 500, 500);
frame.setVisible(true);
Plot3DPanel plot3D = new Plot3DPanel();
plot3D.addScatterPlot("PCA", Color.RED, x, y, z);
plot3D.addLegend("North");
/*plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");*/
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame3D = new JFrame("A 3D Plot Panel");
frame3D.setContentPane(plot3D);
frame3D.setBounds(100, 100, 500, 500);
frame3D.setVisible(true);
}
示例6: main
import org.math.plot.Plot3DPanel; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
double[][] data = {{0, 2, 3, 4}, {2, 0, 4, 5}, {3, 4.1, 5, 6}, {2, 7, 1, 6}};
RealMatrix X = new BlockRealMatrix(data);
/*int n = 20;
int p = 10;
X = rand(p, n);*/
int K = 3;
int r = 3;
RealMatrix R = Isomap.run(X, K, r);
disp("Original Data:");
disp(X);
disp("Reduced Data:");
disp(R);
double[] x = R.getRow(0);
double[] y = R.getRow(1);
double[] z = R.getRow(2);
// create your PlotPanel (you can use it as a JPanel)
Plot2DPanel plot = new Plot2DPanel();
// add a line plot to the PlotPanel
// plot.addLinePlot("my plot", Color.RED, x, y);
// add a scatter plot to the PlotPanel
plot.addScatterPlot("Isomap", Color.RED, x, y);
plot.addLegend("North");
/*plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");*/
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame = new JFrame("A 2D Plot Panel");
frame.setContentPane(plot);
frame.setBounds(100, 100, 500, 500);
frame.setVisible(true);
Plot3DPanel plot3D = new Plot3DPanel();
plot3D.addScatterPlot("Isomap", Color.RED, x, y, z);
plot3D.addLegend("North");
/*plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");*/
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame3D = new JFrame("A 3D Plot Panel");
frame3D.setContentPane(plot3D);
frame3D.setBounds(100, 100, 500, 500);
frame3D.setVisible(true);
}
示例7: main
import org.math.plot.Plot3DPanel; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
double[][] data = {{0, 2, 3, 4}, {2, 0, 4, 5}, {3, 4.1, 5, 6}, {2, 7, 1, 6}};
RealMatrix O = new BlockRealMatrix(data);
/*int n = 20;
int p = 10;
O = rand(p, n);*/
RealMatrix D = l2Distance(O, O);
// fprintf("%g\n", norm(D.subtract(D.transpose())));
RealMatrix R = MDS.run(D, 3);
disp("Original Data:");
disp(O);
disp("Reduced Data:");
disp(R);
double[] x = R.getRow(0);
double[] y = R.getRow(1);
double[] z = R.getRow(2);
// create your PlotPanel (you can use it as a JPanel)
Plot2DPanel plot = new Plot2DPanel();
// add a line plot to the PlotPanel
// plot.addLinePlot("my plot", Color.RED, x, y);
// add a scatter plot to the PlotPanel
plot.addScatterPlot("MultiDimensional Scaling", Color.RED, x, y);
plot.addLegend("North");
/*plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");*/
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame = new JFrame("A 2D Plot Panel");
frame.setContentPane(plot);
frame.setBounds(100, 100, 500, 500);
frame.setVisible(true);
Plot3DPanel plot3D = new Plot3DPanel();
plot3D.addScatterPlot("MultiDimensional Scaling", Color.RED, x, y, z);
plot3D.addLegend("North");
/*plot.setAxisLabel(0, "this");
plot.setAxisLabel(1, "that");*/
// plot.addLabel("this", Color.RED, new double[]{0, 0});
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame3D = new JFrame("A 3D Plot Panel");
frame3D.setContentPane(plot3D);
frame3D.setBounds(100, 100, 500, 500);
frame3D.setVisible(true);
}