qiskit/visualization/bloch.py
def plot_points(self):
        """Plot points"""
        # -X and Y data are switched for plotting purposes
        for k in range(len(self.points)):
            num = len(self.points[k][0])
            dist = [np.sqrt(self.points[k][0][j] ** 2 +
                            self.points[k][1][j] ** 2 +
                            self.points[k][2][j] ** 2) for j in range(num)]
            if any(abs(dist - dist[0]) / dist[0] > 1e-12):
                # combine arrays so that they can be sorted together
                zipped = list(zip(dist, range(num)))
                zipped.sort()  # sort rates from lowest to highest
                dist, indperm = zip(*zipped)
                indperm = np.array(indperm)
            else:
                indperm = np.arange(num)
            if self.point_style[k] == 's':
                self.axes.scatter(
                    np.real(self.points[k][1][indperm]),
                    - np.real(self.points[k][0][indperm]),
                    np.real(self.points[k][2][indperm]),
                    s=self.point_size[np.mod(k, len(self.point_size))],
                    alpha=1,
                    edgecolor='none',
                    zdir='z',
                    color=self.point_color[np.mod(k, len(self.point_color))],
                    marker=self.point_marker[np.mod(k,
                                                    len(self.point_marker))])

            elif self.point_style[k] == 'm':
                pnt_colors = np.array(self.point_color *
                                      int(np.ceil(num /
                                                  float(len(self.point_color)))))

                pnt_colors = pnt_colors[0:num]
                pnt_colors = list(pnt_colors[indperm])
                marker = self.point_marker[np.mod(k, len(self.point_marker))]
                pnt_size = self.point_size[np.mod(k, len(self.point_size))]
                self.axes.scatter(np.real(self.points[k][1][indperm]),
                                  -np.real(self.points[k][0][indperm]),
                                  np.real(self.points[k][2][indperm]),
                                  s=pnt_size, alpha=1, edgecolor='none',
                                  zdir='z', color=pnt_colors,
                                  marker=marker)

            elif self.point_style[k] == 'l':
                color = self.point_color[np.mod(k, len(self.point_color))]
                self.axes.plot(np.real(self.points[k][1]),
                               -np.real(self.points[k][0]),
                               np.real(self.points[k][2]),
                               alpha=0.75, zdir='z',
                               color=color)
def plot_points(self):
        """Plot points"""
        # -X and Y data are switched for plotting purposes
        for k in range(len(self.points)):
            num = len(self.points[k][0])
            dist = [np.sqrt(self.points[k][0][j] ** 2 +
                            self.points[k][1][j] ** 2 +
                            self.points[k][2][j] ** 2) for j in range(num)]
            if any(abs(dist - dist[0]) / dist[0] > 1e-12):
                # combine arrays so that they can be sorted together
                zipped = list(zip(dist, range(num)))
                zipped.sort()  # sort rates from lowest to highest
                dist, indperm = zip(*zipped)
                indperm = np.array(indperm)
            else:
                indperm = np.arange(num)
            if self.point_style[k] == 's':
                self.axes.scatter(
                    np.real(self.points[k][1][indperm]),
                    - np.real(self.points[k][0][indperm]),
                    np.real(self.points[k][2][indperm]),
                    s=self.point_size[np.mod(k, len(self.point_size))],
                    alpha=1,
                    edgecolor='none',
                    zdir='z',
                    color=self.point_color[np.mod(k, len(self.point_color))],
                    marker=self.point_marker[np.mod(k,
                                                    len(self.point_marker))])

            elif self.point_style[k] == 'm':
                pnt_colors = np.array(self.point_color *
                                      int(np.ceil(num /
                                                  float(len(self.point_color)))))

                pnt_colors = pnt_colors[0:num]
                pnt_colors = list(pnt_colors[indperm])
                marker = self.point_marker[np.mod(k, len(self.point_marker))]
                pnt_size = self.point_size[np.mod(k, len(self.point_size))]
                self.axes.scatter(np.real(self.points[k][1][indperm]),
                                  -np.real(self.points[k][0][indperm]),
                                  np.real(self.points[k][2][indperm]),
                                  s=pnt_size, alpha=1, edgecolor='none',
                                  zdir='z', color=pnt_colors,
                                  marker=marker)

            elif self.point_style[k] == 'l':
                color = self.point_color[np.mod(k, len(self.point_color))]
                self.axes.plot(np.real(self.points[k][1]),
                               -np.real(self.points[k][0]),
                               np.real(self.points[k][2]),
                               alpha=0.75, zdir='z',
                               color=color)
Plot points