I am trying to render a Plotter object created by Seaborn.object.Bar() on Qwidget from PyQt6.
plot = (
so.Plot(result, x = 'XXX', y = 'XXX')
.add(so.Bar(color='lightblue'))
.label(title = "XXX", x = 'XXX', y = 'XXX')
)
I used to render plots by passing Axes object generated by Figure.add_subplot() to Seaborn.barplot() method as a kwarg and then converting them into QWidget objects by using FigureCanvasQTAgg class from matplotlib.backends.backend_qtagg
fig = Figure()
ax = fig.add_subplot(111)
...
sns.barplot(..., ax = ax)
...
self.main_layout.addWidget(FigureCanvasQTAgg(fig))
But since FigureCanvasQTAgg only take a Figure object as an argument, I am pretty stuck here.
I can't test it with your code but in documentation for Plot
I found Plot.on(ax) (Plot.on(fig)
)
So maybe your code should use
plot.on(ax) # plot.on(fig)
or in one line with other functions
plot = ( so.Plot(...).on(ax).add(...).label(...) )
#plot = ( so.Plot(...).on(fig).add(...).label(...) )
plot = ( so.Plot(...).add(...).label(...).on(ax) )
#plot = ( so.Plot(...).add(...).label(...).on(fig) )