• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EnumeratedData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中de.erichseifert.gral.data.EnumeratedData的典型用法代码示例。如果您正苦于以下问题:Java EnumeratedData类的具体用法?Java EnumeratedData怎么用?Java EnumeratedData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EnumeratedData类属于de.erichseifert.gral.data包,在下文中一共展示了EnumeratedData类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: HistogramPlot

import de.erichseifert.gral.data.EnumeratedData; //导入依赖的package包/类
public HistogramPlot() {
	// Create example data
	Random random = new Random();
	DataTable data = new DataTable(Double.class);
	for (int i = 0; i < SAMPLE_COUNT; i++) {
		data.add(random.nextGaussian());
	}

	// Create histogram from data
	Histogram1D histogram = new Histogram1D(data, Orientation.VERTICAL,
			new Number[] {-4.0, -3.2, -2.4, -1.6, -0.8, 0.0, 0.8, 1.6, 2.4, 3.2, 4.0});
	// Create a second dimension (x axis) for plotting
	DataSource histogram2d = new EnumeratedData(histogram, (-4.0 + -3.2)/2.0, 0.8);

	// Create new bar plot
	BarPlot plot = new BarPlot(histogram2d);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 65.0, 50.0, 40.0));
	plot.getTitle().setText(
			String.format("Distribution of %d random samples", data.getRowCount()));
	plot.setBarWidth(0.78);

	// Format x axis
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickSpacing(0.8);
	plot.getAxisRenderer(BarPlot.AXIS_X).setMinorTicksVisible(false);
	// Format y axis
	plot.getAxis(BarPlot.AXIS_Y).setRange(0.0,
			MathUtils.ceil(histogram.getStatistics().get(Statistics.MAX)*1.1, 25.0));
	plot.getAxisRenderer(BarPlot.AXIS_Y).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setMinorTicksVisible(false);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setIntersection(-4.4);

	// Format bars
	plot.getPointRenderer(histogram2d).setColor(
		GraphicsUtils.deriveWithAlpha(COLOR1, 128));
	plot.getPointRenderer(histogram2d).setValueVisible(true);

	// Add plot to Swing component
	InteractivePanel panel = new InteractivePanel(plot);
	panel.setPannable(false);
	panel.setZoomable(false);
	add(panel);
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:46,代码来源:HistogramPlot.java


示例2: setUp

import de.erichseifert.gral.data.EnumeratedData; //导入依赖的package包/类
@Before
public void setUp() {
	data = new EnumeratedData(new DummyData(5, 3, 1.0));
	plot = new MockBoxPlot(data);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:6,代码来源:BoxPlotTest.java


示例3: HistogramPlot

import de.erichseifert.gral.data.EnumeratedData; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public HistogramPlot() {
	// Create example data
	Random random = new Random();
	DataTable data = new DataTable(Double.class);
	for (int i = 0; i < SAMPLE_COUNT; i++) {
		data.add(random.nextGaussian());
	}

	// Create histogram from data
	Histogram2D histogram = new Histogram2D(data, Orientation.VERTICAL,
			new Number[] {-4.0, -3.2, -2.4, -1.6, -0.8, 0.0, 0.8, 1.6, 2.4, 3.6, 4.0});
	// Create a second dimension (x axis) for plotting
	DataSource histogram2d = new EnumeratedData(histogram, (-4.0 + -3.2)/2.0, 0.8);

	// Create new bar plot
	BarPlot plot = new BarPlot(histogram2d);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 65.0, 50.0, 40.0));
	plot.getTitle().setText(
			String.format("Distribution of %d random samples", data.getRowCount()));
	plot.setBarWidth(0.78);

	// Format x axis
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickSpacing(0.8);
	plot.getAxisRenderer(BarPlot.AXIS_X).setMinorTicksVisible(false);
	// Format y axis
	plot.getAxis(BarPlot.AXIS_Y).setRange(0.0,
			MathUtils.ceil(histogram.getStatistics().get(Statistics.MAX)*1.1, 25.0));
	plot.getAxisRenderer(BarPlot.AXIS_Y).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setMinorTicksVisible(false);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setIntersection(-4.4);

	// Format bars
	PointRenderer barRenderer = plot.getPointRenderers(histogram2d).get(0);
	barRenderer.setColor(GraphicsUtils.deriveWithAlpha(COLOR1, 128));
	barRenderer.setValueVisible(true);

	// Add plot to Swing component
	InteractivePanel panel = new InteractivePanel(plot);
	panel.setPannable(false);
	panel.setZoomable(false);
	add(panel);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:47,代码来源:HistogramPlot.java


示例4: HistogramPlot

import de.erichseifert.gral.data.EnumeratedData; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public HistogramPlot() {
	// Create example data
	Random random = new Random();
	DataTable data = new DataTable(Double.class);
	for (int i = 0; i < SAMPLE_COUNT; i++) {
		data.add(random.nextGaussian());
	}

	// Create histogram from data
	Histogram1D histogram = new Histogram1D(data, Orientation.VERTICAL,
			new Number[] {-4.0, -3.2, -2.4, -1.6, -0.8, 0.0, 0.8, 1.6, 2.4, 3.6, 4.0});
	// Create a second dimension (x axis) for plotting
	DataSource histogram2d = new EnumeratedData(histogram, (-4.0 + -3.2)/2.0, 0.8);

	// Create new bar plot
	BarPlot plot = new BarPlot(histogram2d);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 65.0, 50.0, 40.0));
	plot.getTitle().setText(
			String.format("Distribution of %d random samples", data.getRowCount()));
	plot.setBarWidth(0.78);

	// Format x axis
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickSpacing(0.8);
	plot.getAxisRenderer(BarPlot.AXIS_X).setMinorTicksVisible(false);
	// Format y axis
	plot.getAxis(BarPlot.AXIS_Y).setRange(0.0,
			MathUtils.ceil(histogram.getStatistics().get(Statistics.MAX)*1.1, 25.0));
	plot.getAxisRenderer(BarPlot.AXIS_Y).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setMinorTicksVisible(false);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setIntersection(-4.4);

	// Format bars
	plot.getPointRenderer(histogram2d).setColor(
		GraphicsUtils.deriveWithAlpha(COLOR1, 128));
	plot.getPointRenderer(histogram2d).setValueVisible(true);

	// Add plot to Swing component
	InteractivePanel panel = new InteractivePanel(plot);
	panel.setPannable(false);
	panel.setZoomable(false);
	add(panel);
}
 
开发者ID:arahusky,项目名称:performance_javadoc,代码行数:47,代码来源:HistogramPlot.java


示例5: getLongHistogramDataSource

import de.erichseifert.gral.data.EnumeratedData; //导入依赖的package包/类
/**
 * Get a DataSource from Long type ArrayList
 * @param list
 * @return data
 */
private DataSource getLongHistogramDataSource(ArrayList<Long> list)
{
    // Create example data
    Long max = Collections.max(list);
    Long min = Collections.min(list);
    int bin = max.intValue() - min.intValue() + 1;
    Double gap = 1d;

    DataTable data = new DataTable(Long.class);

    System.out.println("Bin: " + bin + " SAMPLE:" + SAMPLE);
    System.out.println("Max: " + max + " Min: " + min + " Gap:" + 1);

    if(bin > SAMPLE) {
        bin = SAMPLE;
        gap = (max.doubleValue() - min.doubleValue()) / bin;
    }

    Number[] number = null;

    if(!min.equals(max))
    {
        number = new Number[bin + 1];

        for (int i = 0; i <= bin; i++)
            number[i] = min + i * gap;
    }
    else
    {
        number = new Number[3];
        min =  min - 1;

        number[0] = min;
        number[1] = min + 1;
        number[2] = min + 2;
    }

    for (Long d : list)
    {
        data.add(d);
    }

    // Create histogram from data
    Histogram1D histogram = new Histogram1D(data, Orientation.VERTICAL, number);
    // Create a second dimension (x axis) for plotting
    return new EnumeratedData(histogram, min, gap);
}
 
开发者ID:fjug,项目名称:IDDEA,代码行数:53,代码来源:HistogramPlot.java


示例6: getDoubleHistogramDataSource

import de.erichseifert.gral.data.EnumeratedData; //导入依赖的package包/类
/**
 * Get a DataSource for Double type ArrayList
 * @param list
 * @return data
 */
private DataSource getDoubleHistogramDataSource(ArrayList<Double> list)
{
    // Create example data
    DataTable data = new DataTable(Double.class);

    Double max = Collections.max(list);
    Double min = Collections.min(list);
    Double gap = (max.doubleValue() - min.doubleValue()) / SAMPLE;
    min -= gap;


    System.out.println("NBin: " + SAMPLE);
    System.out.println("Max: " + max + " Min: " + min + " Gap:" + gap);

    Number[] number = null;

    if(min != max)
    {
        number = new Number[SAMPLE + 3];

        for (int i = 0; i < number.length; i++)
            number[i] = min + i * gap;
    }
    else
    {
        number = new Number[3];
        min -= gap;

        number[0] = min;
        number[1] = min + gap;
        number[2] = min + gap;
    }

    for (Double d : list)
    {
        data.add(d);
    }

    // Create histogram from data
    Histogram1D histogram = new Histogram1D(data, Orientation.VERTICAL, number);
    // Create a second dimension (x axis) for plotting
    return new EnumeratedData(histogram, min, gap);
}
 
开发者ID:fjug,项目名称:IDDEA,代码行数:49,代码来源:HistogramPlot.java



注:本文中的de.erichseifert.gral.data.EnumeratedData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Receiver类代码示例发布时间:2022-05-22
下一篇:
Java NavMeshBuilder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap