In the above p.draw() will return a matplotlib figure. You could use this figure to add a subplot and then pass this axis to pandas plot function or use matplotlibs plotting directly. Combining two ggplot plots (or any existing plot with a new ggplot plot) is currently not possible (see github.com/yhat/ggplot/issues/160 and github.com/yhat/ggplot/issues/181).
How can I place a python gglot figure in a gui?
-
12-10-2022 - |
Frage
fI have done my data analysis in ipython using pandas and ggplot, but now i would like to move this to a gui and thought to use pyqt.
To create a figure in pyqt i would usually use matplotlib, something along these lines..
import matplotlib.pyplot as plt
figure = plt.figure()
figure.add_subplot(111)
ax.plot(data, '*-')
But I would like to use the integration between pandas and ggplot. But this does not work
p = ggplot(mtcars, aes('mpg', 'qsec')) + geom_point(colour='steelblue')
ax.plot(p)
How can I plot a python ggplot figure in a pyqt program?
Lösung
Andere Tipps
I got a python ggplot figure working in a PyQt5
by setting the style of pyplot
.
import matplotlib.pyplot as plt
plt.style.use('ggplot')
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow