Plots the object in a 3D scatter.

    This method should be overriden when possible. This default behavior simply
    samples numPoints points from the object and plots them in a 3d scatter.
435431
def plot(self, numPoints=100):
    
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')

    for feature in self._FEATURES:

      for _ in xrange(numPoints):
        x, y, z = tuple(self.sampleLocationFromFeature(feature))
        ax.scatter(x, y, z, marker=".")

    ax.set_xlabel('X')
    ax.set_ylabel('Y')
    ax.set_zlabel('Z')

    plt.title("{}".format(self))
    return fig, ax
368016
def plot(self, vertices, show=False):
        
        if vertices.shape[1] != 2:
            raise ValueError('only for 2D points!')

        import matplotlib.pyplot as plt

        # get rotation angle in degrees
        angle = np.degrees(self.angle(vertices))

        plt.text(*vertices[self.origin],
                 s=self.text,
                 rotation=angle,
                 ha=self.align[0],
                 va=self.align[1],
                 size=18)

        if show:
            plt.show()
1224534
def render(self, **kwargs):
        
        # Calling parent function
        super(VisVolume, self).render(**kwargs)

        # Initialize variables
        legend_proxy = []
        legend_names = []

        # Start plotting of the surface and the control points grid
        fig = plt.figure(figsize=self.vconf.figure_size, dpi=self.vconf.figure_dpi)
        ax = Axes3D(fig)

        # Start plotting
        for plot in self._plots:
            pts = np.array(plot['ptsarr'], dtype=self.vconf.dtype)
            # Plot control points
            if plot['type'] == 'ctrlpts' and self.vconf.display_ctrlpts:
                ax.scatter(pts[:, 0], pts[:, 1], pts[:, 2], color=plot['color'], marker='^', s=20, depthshade=True)
                plot_proxy = mpl.lines.Line2D([0], [0], linestyle='none', color=plot['color'], marker='^')
                legend_proxy.append(plot_proxy)
                legend_names.append(plot['name'])

            # Plot evaluated points
            if plot['type'] == 'evalpts' and self.vconf.display_evalpts:
                ax.scatter(pts[:, 0], pts[:, 1], pts[:, 2],
                           color=plot['color'], marker='o', s=10, depthshade=True, alpha=self.vconf.alpha)
                plot_proxy = mpl.lines.Line2D([0], [0], linestyle='none', color=plot['color'], marker='o')
                legend_proxy.append(plot_proxy)
                legend_names.append(plot['name'])

            # Plot bounding box
            if plot['type'] == 'bbox' and self.vconf.display_bbox:
                ax.plot(pts[:, 0], pts[:, 1], pts[:, 2], color=plot['color'], linestyle='--')
                plot_proxy = mpl.lines.Line2D([0], [0], linestyle='--', color=plot['color'])
                legend_proxy.append(plot_proxy)
                legend_names.append(plot['name'])

            # Plot extras
            if plot['type'] == 'extras':
                ax.plot(pts[:, 0], pts[:, 1], pts[:, 2],
                        color=plot['color'][0], linestyle='-', linewidth=plot['color'][1])
                plot_proxy = mpl.lines.Line2D([0], [0], linestyle='-', color=plot['color'][0])
                legend_proxy.append(plot_proxy)
                legend_names.append(plot['name'])

        # Add legend to 3D plot, @ref: https://stackoverflow.com/a/20505720
        if self.vconf.display_legend:
            ax.legend(legend_proxy, legend_names, numpoints=1)

        # Remove axes
        if not self.vconf.display_axes:
            plt.axis('off')

        # Set axes equal
        if self.vconf.axes_equal:
            self.vconf.set_axes_equal(ax)

        # Axis labels
        if self.vconf.display_labels:
            ax.set_xlabel('x')
            ax.set_ylabel('y')
            ax.set_zlabel('z')

        # Process keyword arguments
        fig_filename = kwargs.get('fig_save_as', None)
        fig_display = kwargs.get('display_plot', True)

        # Display the plot
        if fig_display:
            plt.show()
        else:
            fig_filename = self.vconf.figure_image_filename if fig_filename is None else fig_filename

        # Save the figure
        self.vconf.save_figure_as(fig, fig_filename)

        # Return the figure object
        return fig
1235816
def draw_point(self, x, y):
        
        check_int_err(lib.SDL_RenderDrawPoint(self._ptr, x, y))
1023906
def drawPolyline(self, points):
        
        for i, p in enumerate(points):
            if i == 0:
                if not (self.lastPoint == Point(p)):
                    self.draw_cont += "%g %g m\n" % JM_TUPLE(Point(p) * self.ipctm)
                    self.lastPoint = Point(p)
            else:
                self.draw_cont += "%g %g l\n" % JM_TUPLE(Point(p) * self.ipctm)
            self.updateRect(p)

        self.lastPoint = Point(points[-1])
        return self.lastPoint
1082615
def plot(self, numPoints=100):
    
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')

    # generate cylinder
    x = np.linspace(- self.dimensions[0]/2., self.dimensions[0]/2., numPoints)
    y = np.linspace(- self.dimensions[1]/2., self.dimensions[1]/2., numPoints)
    z = np.linspace(- self.dimensions[2]/2., self.dimensions[2]/2., numPoints)

    # plot
    Xc, Yc = np.meshgrid(x, y)
    ax.plot_surface(Xc, Yc, -self.dimensions[2]/2,
                    alpha=0.2, rstride=20, cstride=10)
    ax.plot_surface(Xc, Yc, self.dimensions[2]/2,
                    alpha=0.2, rstride=20, cstride=10)
    Yc, Zc = np.meshgrid(y, z)
    ax.plot_surface(-self.dimensions[0]/2, Yc, Zc,
                    alpha=0.2, rstride=20, cstride=10)
    ax.plot_surface(self.dimensions[0]/2, Yc, Zc,
                    alpha=0.2, rstride=20, cstride=10)
    Xc, Zc = np.meshgrid(x, z)
    ax.plot_surface(Xc, -self.dimensions[1]/2, Zc,
                    alpha=0.2, rstride=20, cstride=10)
    ax.plot_surface(Xc, self.dimensions[1]/2, Zc,
                    alpha=0.2, rstride=20, cstride=10)

    ax.set_xlabel("X")
    ax.set_ylabel("Y")
    ax.set_zlabel("Z")

    plt.title("{}".format(self))
    return fig, ax
299636
def draw_points(self, *points):
        
        point_array = ffi.new('SDL_Point[]', len(points))
        for i, p in enumerate(points):
            point_array[i] = p._ptr[0]
        check_int_err(lib.SDL_RenderDrawPoints(self._ptr, point_array, len(points)))
12736
def render(self, **kwargs):
        
        # Calling parent function
        super(VisVoxel, self).render(**kwargs)

        # Initialize variables
        legend_proxy = []
        legend_names = []

        # Start plotting of the surface and the control points grid
        fig = plt.figure(figsize=self.vconf.figure_size, dpi=self.vconf.figure_dpi)
        ax = Axes3D(fig)

        # Start plotting
        for plot in self._plots:
            # Plot control points
            if plot['type'] == 'ctrlpts' and self.vconf.display_ctrlpts:
                pts = np.array(plot['ptsarr'], dtype=self.vconf.dtype)
                ax.scatter(pts[:, 0], pts[:, 1], pts[:, 2], color=plot['color'], marker='^', s=20, depthshade=True)
                plot_proxy = mpl.lines.Line2D([0], [0], linestyle='none', color=plot['color'], marker='^')
                legend_proxy.append(plot_proxy)
                legend_names.append(plot['name'])

            # Plot evaluated points
            if plot['type'] == 'evalpts' and self.vconf.display_evalpts:
                faces = np.array(plot['ptsarr'][1], dtype=self.vconf.dtype)
                filled = np.array(plot['ptsarr'][2], dtype=self.vconf.dtype)
                # Find filled voxels
                faces_filled = np.concatenate(faces[filled == 1.0])
                # Create a single Poly3DCollection object
                pc3d = Poly3DCollection(faces_filled, facecolors=plot['color'], edgecolors='k')
                ax.add_collection3d(pc3d)
                # Set axis limits
                gf_min = np.amin(faces_filled, axis=(0, 1))
                gf_max = np.amax(faces_filled, axis=(0, 1))
                ax.set_xlim([gf_min[0], gf_max[0]])
                ax.set_ylim([gf_min[1], gf_max[1]])
                ax.set_zlim([gf_min[2], gf_max[2]])
                # Legend
                plot_proxy = mpl.lines.Line2D([0], [0], linestyle='none', color=plot['color'], marker='o')
                legend_proxy.append(plot_proxy)
                legend_names.append(plot['name'])

            # Plot bounding box
            if plot['type'] == 'bbox' and self.vconf.display_bbox:
                ax.plot(pts[:, 0], pts[:, 1], pts[:, 2], color=plot['color'], linestyle='--')
                plot_proxy = mpl.lines.Line2D([0], [0], linestyle='--', color=plot['color'])
                legend_proxy.append(plot_proxy)
                legend_names.append(plot['name'])

            # Plot extras
            if plot['type'] == 'extras':
                ax.plot(pts[:, 0], pts[:, 1], pts[:, 2],
                        color=plot['color'][0], linestyle='-', linewidth=plot['color'][1])
                plot_proxy = mpl.lines.Line2D([0], [0], linestyle='-', color=plot['color'][0])
                legend_proxy.append(plot_proxy)
                legend_names.append(plot['name'])

        # Add legend to 3D plot, @ref: https://stackoverflow.com/a/20505720
        if self.vconf.display_legend:
            ax.legend(legend_proxy, legend_names, numpoints=1)

        # Remove axes
        if not self.vconf.display_axes:
            plt.axis('off')

        # Set axes equal
        if self.vconf.axes_equal:
            self.vconf.set_axes_equal(ax)

        # Axis labels
        if self.vconf.display_labels:
            ax.set_xlabel('x')
            ax.set_ylabel('y')
            ax.set_zlabel('z')

        # Process keyword arguments
        fig_filename = kwargs.get('fig_save_as', None)
        fig_display = kwargs.get('display_plot', True)

        # Display the plot
        if fig_display:
            plt.show()
        else:
            fig_filename = self.vconf.figure_image_filename if fig_filename is None else fig_filename

        # Save the figure
        self.vconf.save_figure_as(fig, fig_filename)

        # Return the figure object
        return fig
691051
def draw(obj, plane='3d', inline=False, **kwargs):
    '''
    '''
    if plane.lower() == '3d':
        return _plot_neuron3d(obj, inline, **kwargs)
    return _plot_neuron(obj, plane, inline, **kwargs)
1116166
def _init_draw(self):
        
        if self.original is not None:
            self.original.set_data(np.random.random((10, 10, 3)))
        self.processed.set_data(np.random.random((10, 10, 3)))
975493
public void moveTo(Point3d point) {
		if (this.numTypesProperty.get()>0 && this.types[this.numTypesProperty.get()-1]==PathElementType.MOVE_TO) {
			this.coordsProperty[this.numCoordsProperty.get()-3] = point.xProperty;
			this.coordsProperty[this.numCoordsProperty.get()-2] = point.yProperty;
			this.coordsProperty[this.numCoordsProperty.get()-1] = point.zProperty;
		}
		else {
			ensureSlots(false, 3);
			this.types[this.numTypesProperty.get()] = PathElementType.MOVE_TO;
			this.numTypesProperty.set(this.numTypesProperty.get()+1);

			this.coordsProperty[this.numCoordsProperty.get()] = point.xProperty;
			this.numCoordsProperty.set(this.numCoordsProperty.get()+1);

			this.coordsProperty[this.numCoordsProperty.get()] = point.yProperty;
			this.numCoordsProperty.set(this.numCoordsProperty.get()+1);

			this.coordsProperty[this.numCoordsProperty.get()] = point.zProperty;
			this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
		}
		this.graphicalBounds = null;
		this.logicalBounds = null;
	}
432254
@Override
	public String drawPolyhedron() {
		StringBuilder s = new StringBuilder();

		Point3d[] vertices = getPolyhedronVertices();

		int index = 0;
		double width = getMaxExtension()*0.015;

		for (int[] lineLoop: polyhedron.getLineLoops()) {
			s.append("draw polyhedron");
			s.append(name);
			s.append(index++);
			s.append(" line");
			for (int i: lineLoop) {
				s.append(getJmolPoint(vertices[i]));
			}
			s.append("width ");
			s.append(fDot2(width));
			s.append(" color");
			Color4f c = getPolyhedronColor();
			s.append(getJmolColor(c));
			s.append(" off;");
		}

		return s.toString();
	}
1107051
private void triangulateFeatures(List<AssociatedTriple> inliers,
									 DMatrixRMaj P1, DMatrixRMaj P2, DMatrixRMaj P3) {
		List<DMatrixRMaj> cameraMatrices = new ArrayList<>();
		cameraMatrices.add(P1);
		cameraMatrices.add(P2);
		cameraMatrices.add(P3);

		// need elements to be non-empty so that it can use set().  probably over optimization
		List<Point2D_F64> triangObs = new ArrayList<>();
		triangObs.add(null);
		triangObs.add(null);
		triangObs.add(null);

		Point4D_F64 X = new Point4D_F64();
		for (int i = 0; i < inliers.size(); i++) {
			AssociatedTriple t = inliers.get(i);

			triangObs.set(0,t.p1);
			triangObs.set(1,t.p2);
			triangObs.set(2,t.p3);

			// triangulation can fail if all 3 views have the same pixel value. This has been observed in
			// simulated 3D scenes
			if( triangulator.triangulate(triangObs,cameraMatrices,X)) {
				structure.points[i].set(X.x,X.y,X.z,X.w);
			} else {
				throw new RuntimeException("Failed to triangulate a point in the inlier set?! Handle if this is common");
			}
		}
	}
776133
public void render() {
		if ((engine.usePoints() && (usePoints == INHERIT_POINTS))
				|| (usePoints == USE_POINTS)) {
			TextureImpl.bindNone();
			GL.glEnable(SGL.GL_POINT_SMOOTH);
			GL.glPointSize(size / 2);
			color.bind();
			GL.glBegin(SGL.GL_POINTS);
			GL.glVertex2f(x, y);
			GL.glEnd();
		} else if (oriented || scaleY != 1.0f) {
			GL.glPushMatrix();

			GL.glTranslatef(x, y, 0f);

			if (oriented) {
				float angle = (float) (Math.atan2(y, x) * 180 / Math.PI);
				GL.glRotatef(angle, 0f, 0f, 1.0f);
			}

			// scale
			GL.glScalef(1.0f, scaleY, 1.0f);

			image.draw((int) (-(size / 2)), (int) (-(size / 2)), (int) size,
					(int) size, color);
			GL.glPopMatrix();
		} else {
			color.bind();
			image.drawEmbedded((int) (x - (size / 2)), (int) (y - (size / 2)),
					(int) size, (int) size);
		}
	}
1347175
def draw(self, layout, coord):
        
        params = copy(self.geom.params)
        params.update(self.stat.params)
        params['zorder'] = self.zorder
        self.data = self.geom.handle_na(self.data)
        # At this point each layer must have the data
        # that is created by the plot build process
        self.geom.draw_layer(self.data, layout, coord, **params)
870711
def draw(self, x, y, xlabel=None, ylabel=None):
        
        # This is a little weird to be here, but it is the best place to perform
        # this computation given how fit calls draw and returns.
        self.corr_ = self.correlation_methods[self.correlation](x, y)

        # First draw the joint plot
        joint_kws = self.joint_kws or {}
        joint_kws.setdefault("alpha", self.alpha)
        joint_kws.setdefault("label", "{}={:0.3f}".format(self.correlation, self.corr_))

        # Draw scatter joint plot
        if self.kind == "scatter":
            self.ax.scatter(x, y, **joint_kws)

            # TODO: Draw best fit line (or should this be kind='reg'?)

        # Draw hexbin joint plot
        elif self.kind in ('hex', 'hexbin'):
            joint_kws.setdefault("mincnt", 1)
            joint_kws.setdefault("gridsize", 50)
            self.ax.hexbin(x, y, **joint_kws)

        # Something bad happened
        else:
            raise ValueError("unknown joint plot kind '{}'".format(self.kind))

        # Set the X and Y axis labels on the plot
        self.ax.set_xlabel(xlabel)
        self.ax.set_ylabel(ylabel)

        # If we're not going to draw histograms, stop here
        if not self.hist:
            # Ensure the current axes is always the main joint plot axes
            plt.sca(self.ax)
            return self.ax

        # Draw the histograms
        hist_kws = self.hist_kws or {}
        hist_kws.setdefault("bins", 50)
        if self.hist == "density":
            hist_kws.setdefault("density", True)

        self.xhax.hist(x, **hist_kws)
        self.yhax.hist(y, orientation="horizontal", **hist_kws)

        # Ensure the current axes is always the main joint plot axes
        plt.sca(self.ax)
        return self.ax
876860
private void project3(double[] output) {
		int observationIndex = 0;
		for( int viewIndex = 0; viewIndex < structure.views.length; viewIndex++ ) {
			SceneStructureProjective.View view = structure.views[viewIndex];
			SceneObservations.View obsView = observations.views[viewIndex];
			for (int i = 0; i < obsView.size(); i++) {
				obsView.get(i,observedPixel);
				SceneStructureMetric.Point worldPt = structure.points[observedPixel.index];
				worldPt.get(p3);
				PerspectiveOps.renderPixel(view.worldToView, p3, predictedPixel);
				int outputIndex = observationIndex*2;
				output[outputIndex  ] = predictedPixel.x - observedPixel.x;
				output[outputIndex+1] = predictedPixel.y - observedPixel.y;
				observationIndex++;
			}
		}
	}