viz_utils/eoas_viz_3d.py
def plot_scatter_np(self, ctr_np, file_name, title=''):
        """
        Makes a 3D scatter plot with the obtained
        :param ctr_np:
        :param file_name:
        :param title:
        :return:
        """
        z, y, x = np.where(ctr_np > 0)
        data=[]
        max_z = max(z)
        min_z= min(z)
        min_y= min(y)
        min_x= min(x)

        # Making data and assigning colors
        print("\tMaking data")
        for z_level in range(int(min_z), int(max_z)):
            color = 'rgb({},0,0)'.format(int(255*(z_level-min_z)/(max_z-min_z)))
            idx = np.where(z == z_level)

            data.append(go.Scatter3d(x=x[idx]-min_x, y=y[idx]-min_y, z=z[idx]-min_z, hoverinfo=None,
                                     mode='markers', marker=dict(symbol='circle',size=2, color=color)))

        # =========== ALL THIS PART IS TO 'IMPROVE' THE LAYOUT ===========
        tick_l = 5
        tick_w = 3
        gridwidth = tick_w
        zerolinewidth = tick_w + 3
        zero_color = 'rgb(0,0,0)'
        grid_color = 'rgb(150,150,150)'
        tickfont = dict( color='black', size=19, family='Old Standard TT, serif', )
        titlefont = dict( color='black', size=35, family='Old Standard TT, serif', )

        # https://plot.ly/python/3d-axes/:w
        layout = go.Layout(
            scene=dict(
                xaxis=dict(
                    nticks=10,
                    gridwidth=gridwidth,
                    tickfont=tickfont,
                    showbackground=True,
                    # zerolinecolor=zero_color,
                    # zerolinewidth=zerolinewidth,
                    backgroundcolor='rgb(255,255,255)',
                    # zeroline=False,
                    gridcolor=grid_color,
                    # ticklen=tick_l,
                    # tickwidth=tick_w,
                    titlefont=titlefont
                ),
                yaxis=dict(
                    nticks=5,
                    gridwidth=gridwidth,
                    showbackground=True,
                    tickfont=tickfont,
                    # zeroline=False,
                    # zerolinewidth=zerolinewidth,
                    # zerolinecolor=zero_color,
                    backgroundcolor='rgb(255,255,255)',
                    gridcolor=grid_color,
                    # ticklen=tick_l,
                    # tickwidth=tick_w,
                    titlefont=titlefont
                ),
                zaxis=dict(
                    nticks=5,
                    gridwidth=gridwidth,
                    showbackground=True,
                    tickfont=tickfont,
                    # zeroline=False,
                    # zerolinewidth=zerolinewidth,
                    # zerolinecolor=zero_color,
                    backgroundcolor='rgb(255,255,255)',
                    gridcolor=grid_color,
                    # ticklen=tick_l,
                    # tickwidth=tick_w,
                    titlefont=titlefont),
                aspectmode='cube',
                camera=dict(
                    up=dict(x=1, y=0, z=0),
                    center=dict(x=0, y=0, z=0),
                    eye=dict(x=2, y=-3, z=1.5))
            ))

        fig = go.Figure(data=data, layout=layout)

        file_name = file_name if file_name.find('html') != -1 else F'{file_name}.html'
        fig['layout'].update( title=title)
        plotly.offline.plot(fig, filename=join(self.output_folder,self._check_file_name(file_name)), auto_open=self.open_browser)

        Makes a 3D scatter plot with the obtained
        :param ctr_np:
        :param file_name:
        :param title:
        :return:
        
Makes a 3D scatter plot with the obtained
Makes a 3D scatter plot with the obtained
def plot_scatter_np(self, ctr_np, file_name, title=''):
        z, y, x = np.where(ctr_np > 0)
        data=[]
        max_z = max(z)
        min_z= min(z)
        min_y= min(y)
        min_x= min(x)
        print("\tMaking data")
        for z_level in range(int(min_z), int(max_z)):
            color = 'rgb({},0,0)'.format(int(255*(z_level-min_z)/(max_z-min_z)))
            idx = np.where(z == z_level)
            data.append(go.Scatter3d(x=x[idx]-min_x, y=y[idx]-min_y, z=z[idx]-min_z, hoverinfo=None,
                                     mode='markers', marker=dict(symbol='circle',size=2, color=color)))
        tick_l = 5
        tick_w = 3
        gridwidth = tick_w
        zerolinewidth = tick_w + 3
        zero_color = 'rgb(0,0,0)'
        grid_color = 'rgb(150,150,150)'
        tickfont = dict( color='black', size=19, family='Old Standard TT, serif', )
        titlefont = dict( color='black', size=35, family='Old Standard TT, serif', )
        layout = go.Layout(
            scene=dict(
                xaxis=dict(
                    nticks=10,
                    gridwidth=gridwidth,
                    tickfont=tickfont,
                    showbackground=True,
                    backgroundcolor='rgb(255,255,255)',
                    gridcolor=grid_color,
                    titlefont=titlefont
                ),
                yaxis=dict(
                    nticks=5,
                    gridwidth=gridwidth,
                    showbackground=True,
                    tickfont=tickfont,
                    backgroundcolor='rgb(255,255,255)',
                    gridcolor=grid_color,
                    titlefont=titlefont
                ),
                zaxis=dict(
                    nticks=5,
                    gridwidth=gridwidth,
                    showbackground=True,
                    tickfont=tickfont,
                    backgroundcolor='rgb(255,255,255)',
                    gridcolor=grid_color,
                    titlefont=titlefont),
                aspectmode='cube',
                camera=dict(
                    up=dict(x=1, y=0, z=0),
                    center=dict(x=0, y=0, z=0),
                    eye=dict(x=2, y=-3, z=1.5))
            ))
        fig = go.Figure(data=data, layout=layout)
        file_name = file_name if file_name.find('html') != -1 else F'{file_name}.html'
        fig['layout'].update( title=title)
        plotly.offline.plot(fig, filename=join(self.output_folder,self._check_file_name(file_name)), auto_open=self.open_browser)
def plot_scatter_np ( self , ctr_np , file_name , title = '' ) : z , y , x = np . where ( ctr_np > 0 ) data = [ ] max_z = max ( z ) min_z = min ( z ) min_y = min ( y ) min_x = min ( x ) print ( "\tMaking data" ) for z_level in range ( int ( min_z ) , int ( max_z ) ) : color = 'rgb({},0,0)' . format ( int ( 255 * ( z_level - min_z ) / ( max_z - min_z ) ) ) idx = np . where ( z == z_level ) data . append ( go . Scatter3d ( x = x [ idx ] - min_x , y = y [ idx ] - min_y , z = z [ idx ] - min_z , hoverinfo = None , mode = 'markers' , marker = dict ( symbol = 'circle' , size = 2 , color = color ) ) ) tick_l = 5 tick_w = 3 gridwidth = tick_w zerolinewidth = tick_w + 3 zero_color = 'rgb(0,0,0)' grid_color = 'rgb(150,150,150)' tickfont = dict ( color = 'black' , size = 19 , family = 'Old Standard TT, serif' , ) titlefont = dict ( color = 'black' , size = 35 , family = 'Old Standard TT, serif' , ) layout = go . Layout ( scene = dict ( xaxis = dict ( nticks = 10 , gridwidth = gridwidth , tickfont = tickfont , showbackground = True , backgroundcolor = 'rgb(255,255,255)' , gridcolor = grid_color , titlefont = titlefont ) , yaxis = dict ( nticks = 5 , gridwidth = gridwidth , showbackground = True , tickfont = tickfont , backgroundcolor = 'rgb(255,255,255)' , gridcolor = grid_color , titlefont = titlefont ) , zaxis = dict ( nticks = 5 , gridwidth = gridwidth , showbackground = True , tickfont = tickfont , backgroundcolor = 'rgb(255,255,255)' , gridcolor = grid_color , titlefont = titlefont ) , aspectmode = 'cube' , camera = dict ( up = dict ( x = 1 , y = 0 , z = 0 ) , center = dict ( x = 0 , y = 0 , z = 0 ) , eye = dict ( x = 2 , y = - 3 , z = 1.5 ) ) ) ) fig = go . Figure ( data = data , layout = layout ) file_name = file_name if file_name . find ( 'html' ) != - 1 else F'{file_name}.html' fig [ 'layout' ] . update ( title = title ) plotly . offline . plot ( fig , filename = join ( self . output_folder , self . _check_file_name ( file_name ) ) , auto_open = self . open_browser )
Makes a 3D scatter plot with the obtained
Makes a 3D scatter plot with the obtained
"""
        Makes a 3D scatter plot with the obtained
        :param ctr_np:
        :param file_name:
        :param title:
        :return:
        """ # Making data and assigning colors # =========== ALL THIS PART IS TO 'IMPROVE' THE LAYOUT =========== # https://plot.ly/python/3d-axes/:w # zerolinecolor=zero_color, # zerolinewidth=zerolinewidth, # zeroline=False, # ticklen=tick_l, # tickwidth=tick_w, # zeroline=False, # zerolinewidth=zerolinewidth, # zerolinecolor=zero_color, # ticklen=tick_l, # tickwidth=tick_w, # zeroline=False, # zerolinewidth=zerolinewidth, # zerolinecolor=zero_color, # ticklen=tick_l, # tickwidth=tick_w,
None
self
ctr_np
None
file_name
None
title
None