Common visualizer of clusters on 1D, 2D or 3D surface. More...
Public Member Functions | |
def | __init__ (self, number_canvases=1, size_row=1, titles=None) |
Constructor of cluster visualizer. More... | |
def | append_cluster (self, cluster, data=None, canvas=0, marker='.', markersize=None, color=None) |
Appends cluster to canvas for drawing. More... | |
def | append_cluster_attribute (self, index_canvas, index_cluster, data, marker=None, markersize=None) |
Append cluster attribure for cluster on specific canvas. More... | |
def | append_clusters (self, clusters, data=None, canvas=0, marker='.', markersize=None) |
Appends list of cluster to canvas for drawing. More... | |
def | set_canvas_title (self, text, canvas=0) |
Set title for specified canvas. More... | |
def | get_cluster_color (self, index_cluster, index_canvas) |
Returns cluster color on specified canvas. | |
def | save (self, filename, kwargs) |
Saves figure to the specified file. More... | |
def | show (self, figure=None, invisible_axis=True, visible_grid=True, display=True, shift=None) |
Shows clusters (visualize). More... | |
Common visualizer of clusters on 1D, 2D or 3D surface.
Use 'cluster_visualizer_multidim' visualizer in case of data dimension is greater than 3.
Definition at line 390 of file __init__.py.
def pyclustering.cluster.cluster_visualizer.__init__ | ( | self, | |
number_canvases = 1 , |
|||
size_row = 1 , |
|||
titles = None |
|||
) |
Constructor of cluster visualizer.
[in] | number_canvases | (uint): Number of canvases that is used for visualization. |
[in] | size_row | (uint): Amount of canvases that can be placed in one row. |
[in] | titles | (list): List of canvas's titles. |
Example:
Definition at line 399 of file __init__.py.
def pyclustering.cluster.cluster_visualizer.append_cluster | ( | self, | |
cluster, | |||
data = None , |
|||
canvas = 0 , |
|||
marker = '.' , |
|||
markersize = None , |
|||
color = None |
|||
) |
Appends cluster to canvas for drawing.
[in] | cluster | (list): cluster that may consist of indexes of objects from the data or object itself. |
[in] | data | (list): If defines that each element of cluster is considered as a index of object from the data. |
[in] | canvas | (uint): Number of canvas that should be used for displaying cluster. |
[in] | marker | (string): Marker that is used for displaying objects from cluster on the canvas. |
[in] | markersize | (uint): Size of marker. |
[in] | color | (string): Color of marker. |
Definition at line 455 of file __init__.py.
Referenced by pyclustering.cluster.cluster_visualizer.append_clusters().
def pyclustering.cluster.cluster_visualizer.append_cluster_attribute | ( | self, | |
index_canvas, | |||
index_cluster, | |||
data, | |||
marker = None , |
|||
markersize = None |
|||
) |
Append cluster attribure for cluster on specific canvas.
Attribute it is data that is visualized for specific cluster using its color, marker and markersize if last two is not specified.
[in] | index_canvas | (uint): Index canvas where cluster is located. |
[in] | index_cluster | (uint): Index cluster whose attribute should be added. |
[in] | data | (list): List of points (data) that represents attribute. |
[in] | marker | (string): Marker that is used for displaying objects from cluster on the canvas. |
[in] | markersize | (uint): Size of marker. |
Definition at line 510 of file __init__.py.
def pyclustering.cluster.cluster_visualizer.append_clusters | ( | self, | |
clusters, | |||
data = None , |
|||
canvas = 0 , |
|||
marker = '.' , |
|||
markersize = None |
|||
) |
Appends list of cluster to canvas for drawing.
[in] | clusters | (list): List of clusters where each cluster may consist of indexes of objects from the data or object itself. |
[in] | data | (list): If defines that each element of cluster is considered as a index of object from the data. |
[in] | canvas | (uint): Number of canvas that should be used for displaying clusters. |
[in] | marker | (string): Marker that is used for displaying objects from clusters on the canvas. |
[in] | markersize | (uint): Size of marker. |
Definition at line 538 of file __init__.py.
def pyclustering.cluster.cluster_visualizer.save | ( | self, | |
filename, | |||
kwargs | |||
) |
Saves figure to the specified file.
[in] | filename | (string): File where the visualized clusters should be stored. |
[in] | **kwargs | Arbitrary keyword arguments (available arguments: 'invisible_axis', 'visible_grid'). |
Keyword Args:
True
- axes are invisible. By default axis are invisible.True
- grid is displayed. By default grid of each canvas is displayed.There is an example how to save visualized clusters to the PNG file without showing them on a screen:
Definition at line 577 of file __init__.py.
def pyclustering.cluster.cluster_visualizer.set_canvas_title | ( | self, | |
text, | |||
canvas = 0 |
|||
) |
Set title for specified canvas.
[in] | text | (string): Title for canvas. |
[in] | canvas | (uint): Index of canvas where title should be displayed. |
Definition at line 554 of file __init__.py.
def pyclustering.cluster.cluster_visualizer.show | ( | self, | |
figure = None , |
|||
invisible_axis = True , |
|||
visible_grid = True , |
|||
display = True , |
|||
shift = None |
|||
) |
Shows clusters (visualize).
[in] | figure | (fig): Defines requirement to use specified figure, if None - new figure is created for drawing clusters. |
[in] | invisible_axis | (bool): Defines visibility of axes on each canvas, if True - axes are invisible. |
[in] | visible_grid | (bool): Defines visibility of grid on each canvas, if True - grid is displayed. |
[in] | display | (bool): Defines requirement to display clusters on a stage, if True - clusters are displayed, if False - plt.show() should be called by user." |
[in] | shift | (uint): Force canvas shift value - defines canvas index from which custers should be visualized. |
Definition at line 615 of file __init__.py.
Referenced by pyclustering.cluster.cluster_visualizer.save().