Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for visualizing embeddings #56

Open
realmarcin opened this issue Oct 27, 2023 · 4 comments
Open

Error for visualizing embeddings #56

realmarcin opened this issue Oct 27, 2023 · 4 comments

Comments

@realmarcin
Copy link

Embeddings were successfully generated with Node2VecSkipGramEnsmallen from GRAPE.
However, when trying to visualize the graph dimensionality reduction only the node degree plot showed in the top left, the other plots are blank along with this error message:

0 points=points,
5511 nrows=nrows,
5512 ncols=ncols,
5513 plotting_callbacks=plotting_callbacks,
5514 show_letters=show_letters,
5515 )

File ~/Documents/VIMSS/ontology/KG-Hub/embeddings/venv/lib/python3.10/site-packages/embiggen/visualizations/graph_visualizer.py:5155, in GraphVisualizer._fit_and_plot_all(self, points, nrows, ncols, plotting_callbacks, show_letters)
5150 evaluation_letters = []
5152 for ax, plot_callback, letter in zip(
5153 flat_axes, itertools.chain(plotting_callbacks), "abcdefghjkilmnopqrstuvwxyz"
5154 ):
-> 5155 figure, axes, caption = plot_callback(
5156 figure=figure,
5157 axes=ax,
5158 **(
5159 dict(loc="lower center")
5160 if "loc" in inspect.signature(plot_callback).parameters
5161 else dict()
5162 ),
5163 apply_tight_layout=False,
5164 )
5166 if "heatmap" in caption.lower():
5167 heatmaps_letters.append(letter)

File ~/Documents/VIMSS/ontology/KG-Hub/embeddings/venv/lib/python3.10/site-packages/embiggen/visualizations/graph_visualizer.py:3720, in GraphVisualizer.plot_node_degrees(self, figure, axes, scatter_kwargs, train_indices, test_indices, train_marker, test_marker, use_log_scale, show_title, show_legend, return_caption, loc, annotate_nodes, show_edges, edge_scatter_kwargs, **kwargs)
3649 def plot_node_degrees(
3650 self,
3651 figure: Optional[Figure] = None,
(...)
3666 **kwargs: Dict,
3667 ):
3668 """Plot node degrees heatmap.
3669
3670 Parameters
(...)
3718 Figure and Axis of the plot.
3719 """
-> 3720 return self._plot_node_metric(
3721 metric=np.fromiter(
3722 (
3723 self._support.get_node_degree_from_node_id(node_id)
3724 for node_id in self.iterate_subsampled_node_ids()
3725 ),
3726 dtype=np.uint32,
3727 ),
3728 metric_name="Node degrees",
3729 figure=figure,
3730 axes=axes,
3731 scatter_kwargs=scatter_kwargs,
3732 train_indices=train_indices,
3733 test_indices=test_indices,
3734 train_marker=train_marker,
3735 test_marker=test_marker,
3736 use_log_scale=use_log_scale,
3737 show_title=show_title,
3738 show_legend=show_legend,
3739 return_caption=return_caption,
3740 loc=loc,
3741 annotate_nodes=annotate_nodes,
3742 show_edges=show_edges,
3743 edge_scatter_kwargs=edge_scatter_kwargs,
3744 **kwargs,
3745 )

File ~/Documents/VIMSS/ontology/KG-Hub/embeddings/venv/lib/python3.10/site-packages/embiggen/visualizations/graph_visualizer.py:3630, in GraphVisualizer._plot_node_metric(self, metric, metric_name, figure, axes, scatter_kwargs, train_indices, test_indices, train_marker, test_marker, use_log_scale, show_title, show_legend, return_caption, loc, annotate_nodes, show_edges, edge_scatter_kwargs, **kwargs)
3628 color_bar = figure.colorbar(scatter[0], ax=axes)
3629 color_bar.set_alpha(1)
-> 3630 color_bar.draw_all()
3632 if annotate_nodes:
3633 figure, axes = self.annotate_nodes(
3634 figure=figure,
3635 axes=axes,
3636 points=self._node_decomposition,
3637 )

AttributeError: 'Colorbar' object has no attribute 'draw_all'

@LucaCappelletti94
Copy link
Member

Which version of matplotlib do you have? Have you already updated to the latest?

@realmarcin
Copy link
Author

Here are my current matplotlib versions:

matplotlib 3.8.0
matplotlib-inline 0.1.6

I see there is now a newer 3.8.1, I can try that in case it helps.

@realmarcin
Copy link
Author

I confirmed that the same errors occurs for
matplotlib 3.8.1
matplotlib-inline 0.1.6

@LucaCappelletti94
Copy link
Member

Try with the latest released version on embiggen please, I hope I have patched it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants