Skip to content

Commit

Permalink
Visualizations fix. Deprecated function.
Browse files Browse the repository at this point in the history
  • Loading branch information
panagiotisanagnostou committed Jun 6, 2024
1 parent 1b37869 commit 20cff11
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/HiPart/__utility_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,7 @@ def visualization_preparation(hipart_object, color_map):
dictionary_of_nodes = hipart_object.tree.nodes

# get colormap
color_map = matplotlib.cm.get_cmap(
color_map,
color_map = matplotlib.colormaps[color_map].resampled(
max(hipart_object.tree.leaves(), key=lambda x: x.data["color_key"]).data["color_key"] + 1
)
color_list = [color_map(i) for i in range(color_map.N)]
Expand Down
4 changes: 2 additions & 2 deletions src/HiPart/interactive_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def _Splitpoint_Manipulation(object_path):
category_order = {"cluster": [str(i) for i in np.unique(data_matrix["cluster"])]}

# generate the colors to be used
color_map = matplotlib.cm.get_cmap("tab20", number_of_nodes)
color_map = matplotlib.colormaps["tab20"].resampled(number_of_nodes)
colList = {str(i): _convert_to_hex(color_map(i)) for i in range(color_map.N)}

with open(object_path, "rb") as obj_file:
Expand Down Expand Up @@ -904,7 +904,7 @@ def _Cluster_Scatter_Plot(object_path):
) = _data_preparation(object_path, 0)

# create scatter plot with the split-point shape
color_map = matplotlib.cm.get_cmap("tab20", number_of_nodes)
color_map = matplotlib.colormaps["tab20"].resampled(number_of_nodes)
colList = {str(i): _convert_to_hex(color_map(i)) for i in range(color_map.N)}
category_order = {
"cluster": [str(i) for i in range(len(np.unique(data_matrix["cluster"])))]
Expand Down
2 changes: 1 addition & 1 deletion src/HiPart/visualizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def dendrogram_visualization(hipart_object, cmap="viridis", default_coloring=Tru
default = dendrogram_parameters["above_threshold_color"]

# Initialize the color map based on the number of clusters
color_map = matplotlib.cm.get_cmap(cmap, hipart_object.max_clusters_number)
color_map = matplotlib.colormaps[cmap].resampled(hipart_object.max_clusters_number)

# Create the linkage and the color keys for the dendrogram
Z, link_keys = util.create_linkage(hipart_object.tree, color_keys=True)
Expand Down

0 comments on commit 20cff11

Please sign in to comment.