Skip to content

Histogram Plots key error #281

@M-Lampert

Description

@M-Lampert

I am currently going through the tutorial that explains how to implement your own plot function. It uses a histogram plot as an example that should be usable with pp.plot(graph, kind="hist"). However, in the current pathpyG version, this method throws a KeyError (see StackTrace below). It seems that only part of the functionality is implemented. There is a file hist_plots.py in the visualisations-module but none of the submodules for a specific backend contain a similar file. It seems to me that the tutorial mentioned above stops at the same part where also the implementation is missing.

Is this intended this way? Do we want the histogram plots to be part of our visualisation-functionality or is this only meant for educational purposes? Then we should maybe remove the implementation and make it clear in the tutorial that this functionality does not exist and is only meant as an example.

StackTrace:

KeyError                                  Traceback (most recent call last)
Cell In[3], [line 1](vscode-notebook-cell:?execution_count=3&line=1)
----> [1](vscode-notebook-cell:?execution_count=3&line=1) pp.plot(g, kind='hist', backend='matplotlib')

File /workspaces/pathpyG/src/pathpyG/visualisations/__init__.py:117, in plot(data, kind, **kwargs)
    115     plt.save(filename, **kwargs)
    116 else:
--> [117](.../workspaces/pathpyG/src/pathpyG/visualisations/__init__.py:117)     plt.show(**kwargs)
    118 return plt

File /workspaces/pathpyG/src/pathpyG/visualisations/plot.py:108, in PathPyPlot.show(self, **kwargs)
    105 _backend: str = kwargs.pop("backend", self.config.get("backend", None))
    107 plot_backend = _get_plot_backend(_backend, None)
--> [108](.../workspaces/pathpyG/src/pathpyG/visualisations/plot.py:108) plot_backend.plot(deepcopy(self.data), self._kind, **deepcopy(self.config)).show(**kwargs)

File /workspaces/pathpyG/src/pathpyG/visualisations/_matplotlib/__init__.py:28, in plot(data, kind, **kwargs)
     26 def plot(data: dict, kind: str = "network", **kwargs: Any) -> Any:
     27     """Plot function."""
---> [28](.../workspaces/pathpyG/src/pathpyG/visualisations/_matplotlib/__init__.py:28)     return PLOT_CLASSES[kind](data, **kwargs)

KeyError: 'hist'

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions