Add a ScatterPlot to the simulation

@param scatterID - An ID for the ScatterPlot
@param xAxisLabel - The name of the x axis
@param yAxisLabel - The name of the y axis
@throws ShanksException
422273
public void addScatterPlot(String scatterID, String xAxisLabel, String yAxisLabel) throws ShanksException {
        if (!this.timeCharts.containsKey(scatterID)) {
            ScatterPlotGenerator scatter = new ScatterPlotGenerator();
            scatter.setTitle(scatterID);
            scatter.setXAxisLabel(xAxisLabel);
            scatter.setYAxisLabel(yAxisLabel);
            this.scatterPlots.put(scatterID, scatter);
        } else {
            throw new DuplicatedChartIDException(scatterID);
        }
    }
1225007
function drawAxisLabels() {
            if (yAxisLabel) {
                if (yAxisLabelEl) {
                    yAxisLabelEl.remove();
                }
                yAxisLabelEl = svg.select('.y-axis-label')
                  .append('text')
                    .classed('y-axis-label-text', true)
                    .attr('x', -chartHeight / 2)
                    .attr('y', yAxisLabelOffset)
                    .attr('text-anchor', 'middle')
                    .attr('transform', 'rotate(270 0 0)')
                    .text(yAxisLabel);
            }

            if (xAxisLabel) {
                if (xAxisLabelEl) {
                    xAxisLabelEl.remove();
                }
                xAxisLabelEl = svg.select('.x-axis-label')
                  .append('text')
                    .attr('y', xAxisLabelOffset)
                    .attr('text-anchor', 'middle')
                    .classed('x-axis-label-text', true)
                    .attr('x', chartWidth / 2)
                    .text(xAxisLabel);
            }
        }
118525
function drawAxis() {
            if (isHorizontal) {
                svg.select('.x-axis-group .axis.x')
                    .attr('transform', `translate( 0, ${chartHeight} )`)
                    .call(xAxis);

                svg.select('.y-axis-group.axis')
                    .attr('transform', `translate( ${-xAxisPadding.left}, 0)`)
                    .call(yAxis);
            } else {
                svg.select('.x-axis-group .axis.x')
                    .attr('transform', `translate( 0, ${chartHeight} )`)
                    .call(xAxis);

                svg.select('.y-axis-group.axis')
                    .attr('transform', `translate( ${-xAxisPadding.left}, 0)`)
                    .call(yAxis)
                    .call(adjustYTickLabels);
            }

            if (yAxisLabel) {
                if (yAxisLabelEl) {
                    svg.selectAll('.y-axis-label-text').remove();
                }

                yAxisLabelEl = svg.select('.y-axis-label')
                    .append('text')
                        .classed('y-axis-label-text', true)
                        .attr('x', -chartHeight / 2)
                        .attr('y', yAxisLabelOffset)
                        .attr('text-anchor', 'middle')
                        .attr('transform', 'rotate(270 0 0)')
                        .text(yAxisLabel)
            }
        }
968806
def _update_axes(ax, xincrease, yincrease,
                 xscale=None, yscale=None,
                 xticks=None, yticks=None,
                 xlim=None, ylim=None):
    
    if xincrease is None:
        pass
    elif xincrease and ax.xaxis_inverted():
        ax.invert_xaxis()
    elif not xincrease and not ax.xaxis_inverted():
        ax.invert_xaxis()

    if yincrease is None:
        pass
    elif yincrease and ax.yaxis_inverted():
        ax.invert_yaxis()
    elif not yincrease and not ax.yaxis_inverted():
        ax.invert_yaxis()

    # The default xscale, yscale needs to be None.
    # If we set a scale it resets the axes formatters,
    # This means that set_xscale('linear') on a datetime axis
    # will remove the date labels. So only set the scale when explicitly
    # asked to. https://github.com/matplotlib/matplotlib/issues/8740
    if xscale is not None:
        ax.set_xscale(xscale)
    if yscale is not None:
        ax.set_yscale(yscale)

    if xticks is not None:
        ax.set_xticks(xticks)
    if yticks is not None:
        ax.set_yticks(yticks)

    if xlim is not None:
        ax.set_xlim(xlim)
    if ylim is not None:
        ax.set_ylim(ylim)
685433
def _init_axes(self, data, method='plot',
                   xscale=None, sharex=False, sharey=False,
                   geometry=None, separate=None, **kwargs):
        
        if isinstance(sharex, bool):
            sharex = "all" if sharex else "none"
        if isinstance(sharey, bool):
            sharey = "all" if sharey else "none"

        # parse keywords
        axes_kw = {key: kwargs.pop(key) for key in utils.AXES_PARAMS if
                   key in kwargs}

        # handle geometry and group axes
        if geometry is not None and geometry[0] * geometry[1] == len(data):
            separate = True
        axes_groups = _group_axes_data(data, separate=separate)
        if geometry is None:
            geometry = (len(axes_groups), 1)
        nrows, ncols = geometry
        if axes_groups and nrows * ncols != len(axes_groups):
            # mismatching data and geometry
            raise ValueError("cannot group data into {0} axes with a "
                             "{1}x{2} grid".format(len(axes_groups), nrows,
                                                   ncols))

        # create grid spec
        gs = GridSpec(nrows, ncols)
        axarr = numpy.empty((nrows, ncols), dtype=object)

        # set default labels
        defxlabel = 'xlabel' not in axes_kw
        defylabel = 'ylabel' not in axes_kw
        flatdata = [s for group in axes_groups for s in group]
        for axis in ('x', 'y'):
            unit = _common_axis_unit(flatdata, axis=axis)
            if unit:
                axes_kw.setdefault('{}label'.format(axis),
                                   unit.to_string('latex_inline_dimensional'))

        # create axes for each group and draw each data object
        for group, (row, col) in zip_longest(
                axes_groups, itertools.product(range(nrows), range(ncols)),
                fillvalue=[]):
            # create Axes
            shared_with = {"none": None, "all": axarr[0, 0],
                           "row": axarr[row, 0], "col": axarr[0, col]}
            axes_kw["sharex"] = shared_with[sharex]
            axes_kw["sharey"] = shared_with[sharey]
            axes_kw['xscale'] = xscale if xscale else _parse_xscale(group)
            ax = axarr[row, col] = self.add_subplot(gs[row, col], **axes_kw)

            # plot data
            plot_func = getattr(ax, method)
            if method in ('imshow', 'pcolormesh'):
                for obj in group:
                    plot_func(obj, **kwargs)
            elif group:
                plot_func(*group, **kwargs)

            # set default axis labels
            for axis, share, pos, n, def_ in (
                    (ax.xaxis, sharex, row, nrows, defxlabel),
                    (ax.yaxis, sharey, col, ncols, defylabel),
            ):
                # hide label if shared axis and not bottom left panel
                if share == 'all' and pos < n - 1:
                    axis.set_label_text('')
                # otherwise set default status
                else:
                    axis.isDefault_label = def_

        return self.axes
170626
function () {
		var chart = this,
			options = this.options,
			xAxisOptions = options.xAxis = splat(options.xAxis || {}),
			yAxisOptions = options.yAxis = splat(options.yAxis || {}),
			optionsArray,
			axis;

		// make sure the options are arrays and add some members
		each(xAxisOptions, function (axis, i) {
			axis.index = i;
			axis.isX = true;
		});

		each(yAxisOptions, function (axis, i) {
			axis.index = i;
		});

		// concatenate all axis options into one array
		optionsArray = xAxisOptions.concat(yAxisOptions);

		each(optionsArray, function (axisOptions) {
			axis = new Axis(chart, axisOptions);
		});

		chart.adjustTickAmounts();
	}
194672
public void addTimeChart(String chartID, String xAxisLabel,
            String yAxisLabel) throws ShanksException {
        Scenario2DPortrayal scenarioPortrayal = (Scenario2DPortrayal) this
                .getSimulation().getScenarioPortrayal();
        scenarioPortrayal.addTimeChart(chartID, xAxisLabel, yAxisLabel);
    }
321639
function drawAxis(){
            svg.select('.x-axis-group.axis')
                .attr('transform', `translate(0, ${chartHeight})`)
                .call(xAxis);

            svg.selectAll('.x-axis-group .tick text')
                .style('text-anchor', 'start')
                .attr('transform', 'rotate(45 -1 10)');

            if (xAxisLabel) {
                if (xAxisLabelEl) {
                    svg.selectAll('.x-axis-label-text').remove();
                }
                xAxisLabelEl = svg.select('.x-axis-label')
                  .append('text')
                    .attr('y', xAxisLabelOffset)
                    .attr('text-anchor', 'middle')
                    .classed('x-axis-label-text', true)
                    .attr('x', chartWidth / 2)
                    .text(xAxisLabel);
            }

            svg.select('.y-axis-group.axis')
                .call(yAxis);

            if (yAxisLabel) {
                if (yAxisLabelEl) {
                    svg.selectAll('.y-axis-label-text').remove();
                }
                yAxisLabelEl = svg.select('.y-axis-label')
                  .append('text')
                    .classed('y-axis-label-text', true)
                    .attr('x', -chartHeight / 2)
                    .attr('y', yAxisLabelOffset)
                    .attr('text-anchor', 'middle')
                    .attr('transform', 'rotate(270 0 0)')
                    .text(yAxisLabel);
            }
        }
188193
function (chart, userOptions) {


            var isXAxis = userOptions.isX,
              axis = this;

            // Flag, is the axis horizontal
            axis.horiz = chart.inverted ? !isXAxis : isXAxis;

            // Flag, isXAxis
            axis.isXAxis = isXAxis;
            axis.coll = isXAxis ? 'xAxis' : 'yAxis';

            axis.opposite = userOptions.opposite; // needed in setOptions
            axis.side = userOptions.side || (axis.horiz ?
                (axis.opposite ? 0 : 2) : // top : bottom
                (axis.opposite ? 1 : 3));  // right : left

            axis.setOptions(userOptions);


            var options = this.options,
              type = options.type,
              isDatetimeAxis = type === 'datetime';

            axis.labelFormatter = options.labels.formatter || axis.defaultLabelFormatter; // can be overwritten by dynamic format


            // Flag, stagger lines or not
            axis.userOptions = userOptions;

            //axis.axisTitleMargin = UNDEFINED,// = options.title.margin,
            axis.minPixelPadding = 0;
            //axis.ignoreMinPadding = UNDEFINED; // can be set to true by a column or bar series
            //axis.ignoreMaxPadding = UNDEFINED;

            axis.chart = chart;
            axis.reversed = options.reversed;
            axis.zoomEnabled = options.zoomEnabled !== false;

            // Initial categories
            axis.categories = options.categories || type === 'category';
            axis.names = [];

            // Elements
            //axis.axisGroup = UNDEFINED;
            //axis.gridGroup = UNDEFINED;
            //axis.axisTitle = UNDEFINED;
            //axis.axisLine = UNDEFINED;

            // Shorthand types
            axis.isLog = type === 'logarithmic';
            axis.isDatetimeAxis = isDatetimeAxis;

            // Flag, if axis is linked to another axis
            axis.isLinked = defined(options.linkedTo);
            // Linked axis.
            //axis.linkedParent = UNDEFINED;

            // Tick positions
            //axis.tickPositions = UNDEFINED; // array containing predefined positions
            // Tick intervals
            //axis.tickInterval = UNDEFINED;
            //axis.minorTickInterval = UNDEFINED;

            axis.tickmarkOffset = (axis.categories && options.tickmarkPlacement === 'between' &&
            pick(options.tickInterval, 1) === 1) ? 0.5 : 0; // #3202

            // Major ticks
            axis.ticks = {};
            axis.labelEdge = [];
            // Minor ticks
            axis.minorTicks = {};
            //axis.tickAmount = UNDEFINED;

            // List of plotLines/Bands
            axis.plotLinesAndBands = [];

            // Alternate bands
            axis.alternateBands = {};

            // Axis metrics
            //axis.left = UNDEFINED;
            //axis.top = UNDEFINED;
            //axis.width = UNDEFINED;
            //axis.height = UNDEFINED;
            //axis.bottom = UNDEFINED;
            //axis.right = UNDEFINED;
            //axis.transA = UNDEFINED;
            //axis.transB = UNDEFINED;
            //axis.oldTransA = UNDEFINED;
            axis.len = 0;
            //axis.oldMin = UNDEFINED;
            //axis.oldMax = UNDEFINED;
            //axis.oldUserMin = UNDEFINED;
            //axis.oldUserMax = UNDEFINED;
            //axis.oldAxisLength = UNDEFINED;
            axis.minRange = axis.userMinRange = options.minRange || options.maxZoom;
            axis.range = options.range;
            axis.offset = options.offset || 0;


            // Dictionary for stacks
            axis.stacks = {};
            axis.oldStacks = {};

            // Min and max in the data
            //axis.dataMin = UNDEFINED,
            //axis.dataMax = UNDEFINED,

            // The axis range
            axis.max = null;
            axis.min = null;

            // User set min and max
            //axis.userMin = UNDEFINED,
            //axis.userMax = UNDEFINED,

            // Crosshair options
            axis.crosshair = pick(options.crosshair, splat(chart.options.tooltip.crosshairs)[isXAxis ? 0 : 1], false);
            // Run Axis

            var eventType,
              events = axis.options.events;

            // Register
            if (inArray(axis, chart.axes) === -1) { // don't add it again on Axis.update()
                if (isXAxis && !this.isColorAxis) { // #2713
                    chart.axes.splice(chart.xAxis.length, 0, axis);
                } else {
                    chart.axes.push(axis);
                }

                chart[axis.coll].push(axis);
            }

            axis.series = axis.series || []; // populated by Series

            // inverted charts have reversed xAxes as default
            if (chart.inverted && isXAxis && axis.reversed === UNDEFINED) {
                axis.reversed = true;
            }

            axis.removePlotBand = axis.removePlotBandOrLine;
            axis.removePlotLine = axis.removePlotBandOrLine;


            // register event listeners
            for (eventType in events) {
                addEvent(axis, eventType, events[eventType]);
            }

            // extend logarithmic axis
            if (axis.isLog) {
                axis.val2lin = log2lin;
                axis.lin2val = lin2log;
            }
        }
131535
private void drawYLabel(Graphics2D chartGraphics) {
    if (yAxisLabel != null) {
      // Strings are drawn from the baseline position of the leftmost char.
      int yPosYAxisLabel = heatMapC.y + (yAxisLabelSize.width / 2);
      int xPosYAxisLabel = (margin / 2) + yAxisLabelAscent;

      chartGraphics.setFont(axisLabelsFont);
      chartGraphics.setColor(axisLabelColour);

      // Create 270 degree rotated transform.
      AffineTransform transform = chartGraphics.getTransform();
      AffineTransform originalTransform = (AffineTransform) transform.clone();
      transform.rotate(Math.toRadians(270), xPosYAxisLabel, yPosYAxisLabel);
      chartGraphics.setTransform(transform);

      // Draw string.
      chartGraphics.drawString(yAxisLabel, xPosYAxisLabel, yPosYAxisLabel);

      // Revert to original transform before rotation.
      chartGraphics.setTransform(originalTransform);
    }
  }
241778
public static PlotCanvas plot(double[][] data, int xbins, int ybins) {
        return plot(data, xbins, ybins, null);
    }
1263086
public Axis addLabel(String label, double location) {
        if (labels == null) {
            labels = new HashMap<>();
        }

        labels.put(label, location);
        setSlice();
        initGridLines();
        initGridLabels();
        return this;
    }
1288949
public void removeScatterPlot(String scatterID) throws ShanksException {
        Scenario2DPortrayal scenarioPortrayal = (Scenario2DPortrayal) this
                .getSimulation().getScenarioPortrayal();
        scenarioPortrayal.removeScatterPlot(scatterID);
    }
909317
public static void plotCharts(List<Chart> charts){
		int numRows =1;
		int numCols =1;
		if(charts.size()>1){
			numRows = (int) Math.ceil(charts.size()/2.0);
			numCols = 2;
		}
		
	    final JFrame frame = new JFrame("");
	    frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        frame.getContentPane().setLayout(new GridLayout(numRows, numCols));
	    for (Chart chart : charts) {
	          if (chart != null) {
	            JPanel chartPanel = new XChartPanel(chart);
	            frame.add(chartPanel);
	          }
	          else {
	            JPanel chartPanel = new JPanel();
	            frame.getContentPane().add(chartPanel);
	          }

	        }
	    // Display the window.
        frame.pack();
        frame.setVisible(true);
	}
451692
public void addHistogram(String histogramID, String xAxisLabel, String yAxisLabel) throws ShanksException {
        if (!this.histograms.containsKey(histogramID)) {
            HistogramGenerator histogram = new HistogramGenerator();
            histogram.setTitle(histogramID);
            histogram.setXAxisLabel(xAxisLabel);
            histogram.setYAxisLabel(yAxisLabel);
            this.histograms.put(histogramID, histogram);
        } else {
            throw new DuplicatedChartIDException(histogramID);
        }
    }
821569
def calculate(self, scene, xaxis, yaxis):
        
        # build the grid location
        sceneRect = scene.sceneRect()
        
        # process axis information
        h_lines  = []
        h_alt    = []
        h_labels = []
        v_lines  = []
        v_alt    = []
        v_labels = []
        
        xlabels   = []
        xcount    = 1
        xsections = 1
        xdelta    = 0
        xdeltamin = 0
        
        ylabels   = []
        ycount    = 1
        ysections = 1
        ydeltamin = 0
        ydelta    = 0
        
        axis_lft  = 0
        axis_rht  = 0
        axis_bot  = 0
        axis_top  = 0
        
        # precalculate xaxis information for width changes
        if xaxis and self.showXAxis():
            size = sceneRect.width()
            xdeltamin = xaxis.minimumLabelWidth()
            result = self.calculateAxis(xaxis, size, xdeltamin)
            
            xlabels, xcount, xsections, newWidth, xdelta = result
            if newWidth != size:
                sceneRect.setWidth(newWidth)
        
        # precalculate yaxis information for height changes
        if yaxis and self.showYAxis():
            size = sceneRect.height()
            ydeltamin = yaxis.minimumLabelHeight()
            result = self.calculateAxis(yaxis, size, ydeltamin)
            
            ylabels, ycount, ysections, newHeight, ydelta = result
            if newHeight != size:
                sceneRect.setHeight(newHeight)
        
        # generate the xaxis
        if xaxis and self.showXAxis():
            x        = sceneRect.left() + xdeltamin / 2
            axis_lft = x
            axis_rht = x
            alt      = False
            
            for i in range(xcount):
                v_lines.append(QLineF(x, sceneRect.top(),
                                      x, sceneRect.bottom()))
                
                # store alternate info
                if alt:
                    alt_rect = QRectF(x - xdelta, sceneRect.top(),
                                      xdelta, sceneRect.height())
                    v_alt.append(alt_rect)
                
                # store label information
                v_labels.append((x, xdelta, xlabels[i]))
                axis_rht = x
                
                x += xdelta
                alt = not alt
        
        # generate the yaxis
        if yaxis and self.showYAxis():
            y        = sceneRect.bottom() - ydeltamin / 2
            axis_bot = y
            axis_top = y
            alt      = False
            
            for i in range(ycount):
                h_lines.append(QLineF(sceneRect.left(), y,
                                      sceneRect.right(), y))
                
                # store alternate color
                if alt:
                    alt_rect = QRectF(sceneRect.left(), y,
                                      sceneRect.width(), ydelta)
                    h_alt.append(alt_rect)
                
                # store the vertical information
                h_labels.append((y, ydelta, ylabels[i]))
                axis_top = y
                
                y -= ydelta
                alt = not alt
        
        # assign the build data
        self._buildData['grid_h_lines']  = h_lines
        self._buildData['grid_h_alt']    = h_alt
        self._buildData['grid_h_labels'] = h_labels
        self._buildData['grid_v_lines']  = v_lines
        self._buildData['grid_v_alt']    = v_alt
        self._buildData['grid_v_labels'] = v_labels
        self._buildData['grid_rect']     = sceneRect
        self._buildData['axis_rect']     = QRectF(axis_lft, axis_top,
                                                  axis_rht - axis_lft,
                                                  axis_bot - axis_top)
        
        scene.setSceneRect(sceneRect)
        return sceneRect
663921
function () {
		var options;
		seriesTypes.scatter.prototype.init.apply(this, arguments);

		options = this.options;
		this.pointRange = options.pointRange = pick(options.pointRange, options.colsize || 1); // #3758, prevent resetting in setData
		this.yAxis.axisPointRange = options.rowsize || 1; // general point range
	}