Possibility to change node shape when plotting signal?
StefanBloemheuvel opened this issue · 3 comments
Hi pygsp team,
I was trying to find a way to change the shape of a node, is that possible? I cannot seem to find the functionality to do so. I did find the way to change vertex size and color, but not the shape of the nodes. I have two types of sensors in my network and I would like to show that clearly in my figures.
Kind regards and thanks in advance!
Stefan
The PyGSP uses matplotlib for plotting. Hence you can do any customization with matplotlib directly.
For example:
from matplotlib import pyplot as plt
import pygsp as pg
graph = pg.graphs.Sensor()
fig, ax = plt.subplots()
graph.plot(ax=ax)
del ax.collections[1]
ax.scatter(*graph.coords.T, marker='s')
Depending on the amount of customization required, it might be easiest to plot the graph with matplotlib. After all, it's just a scatter with a set of lines.
Hi @mdeff , thanks for your response. There is only one issue, since this procedure removes the signal colours from the plot. How could this procedure take place while still showing a signal plotted on the graph?
ax.scatter(*graph.coords.T, c=mysignal, marker='s')
You can do anything matplotlib can (e.g., changing marker size, colormaps, etc.). See matplotlib's doc.