Skip to content

add this plot to MatchedMarkerVolumes #245

@bwheelz36

Description

@bwheelz36
   def plot_3D_markers_with_color_scale(self, cmap=None, title=None, elevation=None, azimuth=None,
                                         vmin=None, vmax=None, return_axs = False):
        
        if cmap is None:
            cmap = plt.cm.viridis

        fig = plt.figure()
        axs = fig.add_subplot(111, projection='3d')

        x_dis = np.abs(self.MatchedCentroids.x_gt - self.MatchedCentroids.x_gnl)
        y_dis = np.abs(self.MatchedCentroids.y_gt - self.MatchedCentroids.y_gnl)
        z_dis = np.abs(self.MatchedCentroids.z_gt - self.MatchedCentroids.z_gnl)
        abs_dis = np.sqrt(x_dis**2 + y_dis**2 + z_dis**2)
        p = axs.scatter(self.MatchedCentroids.x_gt, self.MatchedCentroids.y_gt, self.MatchedCentroids.z_gt,
                        c=abs_dis, cmap=cmap, vmin=vmin, vmax=vmax)
        fig.colorbar(p, ax=axs)
        if elevation:
            axs.elev = elevation
        if azimuth:
            axs.azim = azimuth
        axs.set_xlabel('X [mm]')
        axs.set_ylabel('Y [mm]')
        axs.set_zlabel('Z [mm]')
        if title:
            axs.set_title(title)
        axs.set_box_aspect((np.ptp(self.MatchedCentroids.x_gt), np.ptp(self.MatchedCentroids.y_gt),
                            np.ptp(self.MatchedCentroids.z_gt)))

        if return_axs:
            return  axs
        else:
            plt.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions