Hello,
I am using FigureCanvasGTK4Agg
and NavigationToolbar2GTK4
in a Gtk.Box
. Following code displays slope percentages on an elevation graph:
distances = PyGraph.pointsDf["distance"]
elevations = PyGraph.pointsDf["elevation"]
slopes = PyGraph.pointsDf["slope"].tail(-1)
path = Path(
np.array([np.append(distances, distances[::-1]), np.append(elevations, np.zeros_like(elevations))]).T
)
patch = PathPatch(path, facecolor="none")
self._axes.add_patch(patch)
pcolormesh = self._axes.pcolormesh(
distances,
[elevations.min(), elevations.max()],
np.reshape(slopes, (1, len(distances) - 1)),
cmap=plt.cm.jet,
clip_path=patch,
clip_on=True
)
divider = make_axes_locatable(self._axes)
cax = divider.append_axes("right", size="1%", pad=0.1)
self._colorbar = self._figure.colorbar(pcolormesh, cax=cax, label="Slope (%)")
When moving the graph, there is a rendering issue:
When the clip_path
parameter is disabled, profile is not displayed and the issue is gone.
If I move the graph totally out of the grid, I am getting the following warning:
/usr/lib/python3.11/site-packages/gi/overrides/Gio.py:42: UserWarning: Tight layout not applied. The bottom and top margins cannot be made large enough to accommodate all Axes decorations.
return Gio.Application.run(self, *args, **kwargs)
Any help would be appreciated.