graph-tool 2.98, CachyOS Linux
Plotting a graph generated with gt.triangulation() separately works as expected, but trying to plot it on a subplot gives an error. Should this behaviour be expected? Should the triangulation positions not have the same dimensions as the planar_layout positions?
import graph_tool.all as gt
import numpy as np
from matplotlib import pyplot as plt
points = np.random.random((500, 2)) * 4
print(points.shape) # (500, 2)
g, pos_triangulation = gt.triangulation(points)
pos_planar = gt.planar_layout(g)
# Drawing graphs separately
gt.graph_draw(g, pos=pos_triangulation) # plots fine
gt.graph_draw(g, pos=pos_planar) # plots fine
# Drawing graphs on subplots
fig, axes = plt.subplots(nrows=1, ncols=2)
gt.graph_draw(g, pos=pos_planar, mplfig=axes[0]) # plots fine
gt.graph_draw(g, pos=pos_triangulation, mplfig=axes[1]) # ValueError: cannot reshape array of size 3 into shape (2)
print(pos_planar.get_2d_array().shape) # (2, 500) as expected
print(pos_triangulation.get_2d_array().shape) # (3, 500), but should this not be (2, 500)?
print(pos_triangulation.is_writable()) # True
pos_triangulation.set_2d_array(pos_triangulation.get_2d_array()[0:2]) # trying to a force 2-dimensional array
print(pos_triangulation.get_2d_array().shape) # (3, 500), but still getting a 3-dimensional array