Removes "chartjunk", such as extra lines of axes and tick marks.

    If grid="y" or "x", will add a white grid at the "y" or "x" axes,
    respectively

    If ticklabels="y" or "x", or ['x', 'y'] will remove ticklabels from that
    axis
163850
def remove_chartjunk(ax, spines, grid=None, ticklabels=None, show_ticks=False,
                     xkcd=False):
    '''
    
    '''
    all_spines = ['top', 'bottom', 'right', 'left', 'polar']
    for spine in spines:
        # The try/except is for polar coordinates, which only have a 'polar'
        # spine and none of the others
        try:
            ax.spines[spine].set_visible(False)
        except KeyError:
            pass

    # For the remaining spines, make their line thinner and a slightly
    # off-black dark grey
    if not xkcd:
        for spine in set(all_spines).difference(set(spines)):
            # The try/except is for polar coordinates, which only have a
            # 'polar' spine and none of the others
            try:
                ax.spines[spine].set_linewidth(0.5)
            except KeyError:
                pass
                # ax.spines[spine].set_color(almost_black)
                # ax.spines[spine].set_tick_params(color=almost_black)
                # Check that the axes are not log-scale. If they are, leave
                # the ticks because otherwise people assume a linear scale.
    x_pos = set(['top', 'bottom'])
    y_pos = set(['left', 'right'])
    xy_pos = [x_pos, y_pos]
    xy_ax_names = ['xaxis', 'yaxis']

    for ax_name, pos in zip(xy_ax_names, xy_pos):
        axis = ax.__dict__[ax_name]
        # axis.set_tick_params(color=almost_black)
        #print 'axis.get_scale()', axis.get_scale()
        if show_ticks or axis.get_scale() == 'log':
            # if this spine is not in the list of spines to remove
            for p in pos.difference(spines):
                #print 'p', p
                axis.set_tick_params(direction='out')
                axis.set_ticks_position(p)
                #                axis.set_tick_params(which='both', p)
        else:
            axis.set_ticks_position('none')

    if grid is not None:
        for g in grid:
            assert g in ('x', 'y')
            ax.grid(axis=grid, color='white', linestyle='-', linewidth=0.5)

    if ticklabels is not None:
        if type(ticklabels) is str:
            assert ticklabels in set(('x', 'y'))
            if ticklabels == 'x':
                ax.set_xticklabels([])
            if ticklabels == 'y':
                ax.set_yticklabels([])
        else:
            assert set(ticklabels) | set(('x', 'y')) > 0
            if 'x' in ticklabels:
                ax.set_xticklabels([])
            elif 'y' in ticklabels:
                ax.set_yticklabels([])
375181
def _finalize_ticks(self, axis, dimensions, xticks, yticks, zticks):
        
        ndims = len(dimensions) if dimensions else 0
        xdim = dimensions[0] if ndims else None
        ydim = dimensions[1] if ndims > 1 else None

        # Tick formatting
        if xdim:
            self._set_axis_formatter(axis.xaxis, xdim, self.xformatter)
        if ydim:
            self._set_axis_formatter(axis.yaxis, ydim, self.yformatter)
        if self.projection == '3d':
            zdim = dimensions[2] if ndims > 2 else None
            if zdim or self.zformatter is not None:
                self._set_axis_formatter(axis.zaxis, zdim, self.zformatter)

        xticks = xticks if xticks else self.xticks
        self._set_axis_ticks(axis.xaxis, xticks, log=self.logx,
                             rotation=self.xrotation)

        yticks = yticks if yticks else self.yticks
        self._set_axis_ticks(axis.yaxis, yticks, log=self.logy,
                             rotation=self.yrotation)

        if self.projection == '3d':
            zticks = zticks if zticks else self.zticks
            self._set_axis_ticks(axis.zaxis, zticks, log=self.logz,
                                 rotation=self.zrotation)

        axes_str = 'xy'
        axes_list = [axis.xaxis, axis.yaxis]

        if hasattr(axis, 'zaxis'):
            axes_str += 'z'
            axes_list.append(axis.zaxis)

        for ax, ax_obj in zip(axes_str, axes_list):
            tick_fontsize = self._fontsize('%sticks' % ax,'labelsize',common=False)
            if tick_fontsize: ax_obj.set_tick_params(**tick_fontsize)
455859
def axes_grid(n, sharex=False, sharey=False, subplot_kw=None, **fig_kw):
  ''''''
  r = np.floor(np.sqrt(n))
  r, c = int(r), int(np.ceil(n / r))
  fig, axes = plt.subplots(nrows=r, ncols=c, figsize=(c*4, r*4), squeeze=False,
                           sharex=sharex, sharey=sharey,
                           subplot_kw=subplot_kw, **fig_kw)
  # Turn off any extra axes
  for ax in axes.flat[n:]:
    ax.set_axis_off()
  return fig, axes
58540
def clean_axis(axis):
    """"""
    axis.get_xaxis().set_ticks([])
    axis.get_yaxis().set_ticks([])
    for spine in list(axis.spines.values()):
        spine.set_visible(False)
714281
function drawGridLines(){
            if (maskGridLines) {
                svg.selectAll('.horizontal-grid-line').remove();
            }
            if (baseLine) {
                svg.selectAll('.extended-x-line').remove();
            }

            maskGridLines = svg.select('.grid-lines-group')
                .selectAll('line.horizontal-grid-line')
                .data(yScale.ticks(yTicks))
                .enter()
                  .append('line')
                    .attr('class', 'horizontal-grid-line')
                    .attr('x1', (xAxisPadding.left))
                    .attr('x2', chartWidth)
                    .attr('y1', (d) => yScale(d))
                    .attr('y2', (d) => yScale(d));

            if (baseLine) {
                svg.selectAll('.extended-x-line').remove();
            }

            //draw a horizontal line to extend x-axis till the edges
            baseLine = svg.select('.grid-lines-group')
                .selectAll('line.extended-x-line')
                .data([0])
                .enter()
                  .append('line')
                    .attr('class', 'extended-x-line')
                    .attr('x1', (xAxisPadding.left))
                    .attr('x2', chartWidth)
                    .attr('y1', chartHeight)
                    .attr('y2', chartHeight);
        }
853809
private void removeMarkedObservations() {
		Point2D_F64 observation = new Point2D_F64();

		for (int viewIndex = 0; viewIndex < observations.views.length; viewIndex++) {
//			System.out.println("ViewIndex="+viewIndex);
			SceneObservations.View v = observations.views[viewIndex];
			for(int pointIndex = v.point.size-1; pointIndex >= 0; pointIndex-- ) {
				int pointID = v.getPointId(pointIndex);
				SceneStructureMetric.Point f = structure.points[pointID];
//				System.out.println("   pointIndex="+pointIndex+" pointID="+pointID+" hash="+f.hashCode());
				v.get(pointIndex, observation);

				if( !Double.isNaN(observation.x))
					continue;

				if( !f.views.contains(viewIndex))
					throw new RuntimeException("BUG!");

				// Tell the feature it is no longer visible in this view
				f.removeView(viewIndex);
				// Remove the observation of this feature from the view
				v.remove(pointIndex);
			}
		}
	}
518680
function (keepEvents) {
		var axis = this,
			stacks = axis.stacks,
			stackKey,
			plotLinesAndBands = axis.plotLinesAndBands,
			i;

		// Remove the events
		if (!keepEvents) {
			removeEvent(axis);
		}

		// Destroy each stack total
		for (stackKey in stacks) {
			destroyObjectProperties(stacks[stackKey]);

			stacks[stackKey] = null;
		}

		// Destroy collections
		each([axis.ticks, axis.minorTicks, axis.alternateBands], function (coll) {
			destroyObjectProperties(coll);
		});
		i = plotLinesAndBands.length;
		while (i--) { // #1975
			plotLinesAndBands[i].destroy();
		}

		// Destroy local variables
		each(['stackTotalGroup', 'axisLine', 'axisGroup', 'gridGroup', 'labelGroup', 'axisTitle'], function (prop) {
			if (axis[prop]) {
				axis[prop] = axis[prop].destroy();
			}
		});
	}
654083
def remove(self, *labelvalues):
        if not self._labelnames:
            raise ValueError('No label names were set when constructing %s' % self)

        """"""
        if len(labelvalues) != len(self._labelnames):
            raise ValueError('Incorrect label count (expected %d, got %s)' % (len(self._labelnames), labelvalues))
        labelvalues = tuple(unicode(l) for l in labelvalues)
        with self._lock:
            del self._metrics[labelvalues]
1196417
def axes_off(ax):
    
    ax.set_frame_on(False)
    ax.axes.get_yaxis().set_visible(False)
    ax.axes.get_xaxis().set_visible(False)
174616
private void setGridAxisColors(ro.nextreports.jofc2.model.Chart flashChart, XAxis xAxis, YAxis yAxis) {
        boolean isHorizontal = chart.getType().isHorizontal();
        Color xGridColor = chart.getXGridColor();
        Color yGridColor = chart.getYGridColor();
        if (xGridColor != null) {
            getXAxis(xAxis, yAxis, isHorizontal).setGridColour(getHexColor(xGridColor));
        }
        if ((chart.getXShowGrid() != null) && !chart.getXShowGrid()) {
            if (flashChart.getBackgroundColour() == null) {
                getXAxis(xAxis, yAxis, isHorizontal).setGridColour(getHexColor(DEFAULT_BACKGROUND));
            } else {
                getXAxis(xAxis, yAxis, isHorizontal).setGridColour(flashChart.getBackgroundColour());
            }
        }
        if (yGridColor != null) {
            getYAxis(xAxis, yAxis, isHorizontal).setGridColour(getHexColor(yGridColor));
        }
        if ((chart.getYShowGrid() != null) && !chart.getYShowGrid()) {
            if (flashChart.getBackgroundColour() == null) {
                getYAxis(xAxis, yAxis, isHorizontal).setGridColour(getHexColor(DEFAULT_BACKGROUND));
            } else {
                getYAxis(xAxis, yAxis, isHorizontal).setGridColour(flashChart.getBackgroundColour());
            }
        }
    }
953649
void removeEdgeLabel(EdgeLabel edgeLabel, boolean preserveData) {
        getTopology().lock();
        String fn = this.name + "." + EDGE_PREFIX + edgeLabel.getName();

        if (!uncommittedRemovedEdgeLabels.contains(fn)) {
            uncommittedRemovedEdgeLabels.add(fn);
            TopologyManager.removeEdgeLabel(this.sqlgGraph, edgeLabel);
            for (VertexLabel lbl : edgeLabel.getOutVertexLabels()) {
                lbl.removeOutEdge(edgeLabel);
            }
            for (VertexLabel lbl : edgeLabel.getInVertexLabels()) {
                lbl.removeInEdge(edgeLabel);
            }

            if (!preserveData) {
                edgeLabel.delete();
            }
            getTopology().fire(edgeLabel, "", TopologyChangeAction.DELETE);
        }
    }
1171596
def _setup_axes(self, axes_data):
        """"""

        self.__axes.clear()

        key_setter = [
            ("title", self.__axes.set_title),
            ("xlabel", self.__axes.set_xlabel),
            ("ylabel", self.__axes.set_ylabel),
            ("xscale", self.__axes.set_xscale),
            ("yscale", self.__axes.set_yscale),
            ("xticks", self.__axes.set_xticks),
            ("xtick_labels", self.__axes.set_xticklabels),
            ("xtick_params", self.__axes.tick_params),
            ("yticks", self.__axes.set_yticks),
            ("ytick_labels", self.__axes.set_yticklabels),
            ("ytick_params", self.__axes.tick_params),
            ("xlim", self.__axes.set_xlim),
            ("ylim", self.__axes.set_ylim),
            ("xgrid", self.__axes.xaxis.grid),
            ("ygrid", self.__axes.yaxis.grid),
            ("xdate_format", self._xdate_setter),
        ]

        key2setter = OrderedDict(key_setter)

        for key in key2setter:
            if key in axes_data and axes_data[key]:
                try:
                    kwargs_key = key + "_kwargs"
                    kwargs = axes_data[kwargs_key]

                except KeyError:
                    kwargs = {}

                if key == "title":
                    # Shift title up
                    kwargs["y"] = 1.08

                key2setter[key](axes_data[key], **kwargs)
494565
function (index, xy) {
		var show = true,
			axis = this.axis,
			chart = axis.chart,
			isFirst = this.isFirst,
			isLast = this.isLast,
			x = xy.x,
			reversed = axis.reversed,
			tickPositions = axis.tickPositions;

		if (isFirst || isLast) {

			var sides = this.getLabelSides(),
				leftSide = sides[0],
				rightSide = sides[1],
				plotLeft = chart.plotLeft,
				plotRight = plotLeft + axis.len,
				neighbour = axis.ticks[tickPositions[index + (isFirst ? 1 : -1)]],
				neighbourEdge = neighbour && neighbour.label.xy && neighbour.label.xy.x + neighbour.getLabelSides()[isFirst ? 0 : 1];

			if ((isFirst && !reversed) || (isLast && reversed)) {
				// Is the label spilling out to the left of the plot area?
				if (x + leftSide < plotLeft) {

					// Align it to plot left
					x = plotLeft - leftSide;

					// Hide it if it now overlaps the neighbour label
					if (neighbour && x + rightSide > neighbourEdge) {
						show = false;
					}
				}

			} else {
				// Is the label spilling out to the right of the plot area?
				if (x + rightSide > plotRight) {

					// Align it to plot right
					x = plotRight - rightSide;

					// Hide it if it now overlaps the neighbour label
					if (neighbour && x + leftSide < neighbourEdge) {
						show = false;
					}

				}
			}

			// Set the modified x position of the label
			xy.x = x;
		}
		return show;
	}
1362735
private void addYLabel(YAxis yAxis, String text, int n) {
        YLabel label = new YLabel(text, n);
        label.setRotation(getRotation(chart.getXorientation()));
        label.setColour(getHexColor(chart.getXColor()));
        label.setSize(chart.getYLabelFont().getSize());
        yAxis.addLabels(label);
    }
1013287
private void drawTickMarks(final GraphicsContext CTX) {
        tickMarkCanvas.setCache(false);
        CTX.clearRect(0, 0, tickMarkCanvas.getWidth(), tickMarkCanvas.getHeight());
        CTX.setFill(gauge.getMajorTickMarkColor());

        List<Section> tickMarkSections         = gauge.getTickMarkSections();
        List<Section> tickLabelSections        = gauge.getTickLabelSections();
        Color         majorTickMarkColor       = gauge.getTickMarkColor();
        Color         tickLabelColor           = gauge.getTickLabelColor();
        boolean       smallRange               = Double.compare(gauge.getRange(), 10.0) <= 0;
        double        minValue                 = gauge.getMinValue();
        double        maxValue                 = gauge.getMaxValue();
        double        tmpStepSize              = smallRange ? stepSize / 10 : stepSize;
        Font          tickLabelFont            = Fonts.robotoRegular(0.15 * (Orientation.VERTICAL == orientation ? width : height));
        boolean       tickMarkSectionsVisible  = gauge.getTickMarkSectionsVisible();
        boolean       tickLabelSectionsVisible = gauge.getTickLabelSectionsVisible();
        double        offsetX                  = 0.18345865 * width;
        double        offsetY                  = 0.1 * height;
        double        innerPointX              = 0;
        double        innerPointY              = 0;
        double        outerPointX              = 0.07 * width;
        double        outerPointY              = 0.08 * height;
        double        textPointX               = 0.55 * tickMarkCanvas.getWidth();
        double        textPointY               = 0.7 * tickMarkCanvas.getHeight();
        BigDecimal    minorTickSpaceBD         = BigDecimal.valueOf(gauge.getMinorTickSpace());
        BigDecimal    majorTickSpaceBD         = BigDecimal.valueOf(gauge.getMajorTickSpace());
        BigDecimal    counterBD                = BigDecimal.valueOf(gauge.getMinValue());
        double        counter                  = minValue;
        double        range                    = gauge.getRange();

        for (double i = 0 ; Double.compare(i, range) <= 0 ; i++) {
            if (Orientation.VERTICAL == orientation) {
                innerPointY = counter * tmpStepSize + offsetY;
                outerPointY = innerPointY;
                textPointY  = innerPointY;
            } else {
                innerPointX = counter * tmpStepSize + offsetX;
                outerPointX = innerPointX;
                textPointX  = innerPointX;
            }

            // Set the general tickmark color
            CTX.setStroke(gauge.getTickMarkColor());
            if (Double.compare(counterBD.remainder(majorTickSpaceBD).doubleValue(), 0.0) == 0) {
                // Draw major tick mark
                if (gauge.getMajorTickMarksVisible()) {
                    CTX.setFill(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, majorTickMarkColor) : majorTickMarkColor);
                    CTX.setStroke(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, majorTickMarkColor) : majorTickMarkColor);
                    CTX.setLineWidth(1);
                    CTX.strokeLine(innerPointX, innerPointY, outerPointX, outerPointY);
                }
                // Draw tick label text
                if (gauge.getTickLabelsVisible()) {
                    CTX.save();
                    CTX.translate(textPointX, textPointY);
                    CTX.setFont(tickLabelFont);
                    CTX.setTextAlign(TextAlignment.CENTER);
                    CTX.setTextBaseline(VPos.CENTER);
                    CTX.setFill(tickLabelSectionsVisible ? Helper.getColorOfSection(tickLabelSections, counter, tickLabelColor) : tickLabelColor);
                    if (Orientation.VERTICAL == orientation) {
                        CTX.fillText(Integer.toString((int) (maxValue - counter)), 0, 0);
                    } else {
                        CTX.fillText(Integer.toString((int) counter), 0, 0);
                    }
                    CTX.restore();
                }
            }
            counterBD = counterBD.add(minorTickSpaceBD);
            counter   = counterBD.doubleValue();
            if (counter > maxValue) break;
        }

        tickMarkCanvas.setCache(true);
        tickMarkCanvas.setCacheHint(CacheHint.QUALITY);
    }
777553
function removePlotBandOrLine(id) {
			var i = plotLinesAndBands.length;
			while (i--) {
				if (plotLinesAndBands[i].id === id) {
					plotLinesAndBands[i].destroy();
				}
			}
		}
935614
def remove_col_label(self, event):#, include_pmag=True):
        
        er_possible_headers = self.grid_headers[self.grid_type]['er'][2]
        pmag_possible_headers = self.grid_headers[self.grid_type]['pmag'][2]
        er_actual_headers = self.grid_headers[self.grid_type]['er'][0]
        pmag_actual_headers = self.grid_headers[self.grid_type]['pmag'][0]
        col = event.GetCol()
        label = self.grid.GetColLabelValue(col)
        if '**' in label:
            label = label.strip('**')
        if label in self.grid_headers[self.grid_type]['er'][1]:
            pw.simple_warning("That header is required, and cannot be removed")
            return False
        #elif include_pmag and label in self.grid_headers[self.grid_type]['pmag'][1]:
        #    pw.simple_warning("That header is required, and cannot be removed")
        #    return False
        else:
            print('That header is not required:', label)
            self.grid.remove_col(col)
            #if label in er_possible_headers:
            try:
                print('removing {} from er_actual_headers'.format(label))
                er_actual_headers.remove(label)
            except ValueError:
                pass
            #if label in pmag_possible_headers:
            try:
                pmag_actual_headers.remove(label)
            except ValueError:
                pass
        # causes resize on each column header delete
        # can leave this out if we want.....
        self.main_sizer.Fit(self)