-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Description
Hello,
When attempting to plot something within PyQt6 using Plotly on Windows, an error is encountered: "js: uncaught ReferenceError: Plotly is not defined." This issue prevents the successful execution of Plotly-based visualizations within a PyQt6 application, hindering the intended functionality.
Installed versions:
- plotly (5.9.0)
- pyqt6 (6.5.0)
- pyqt6-webengine (6.5.0)
Script to Reproduce:
import sys
import plotly.express as px
from PyQt6 import QtWebEngineWidgets
from PyQt6.QtWidgets import QApplication, QVBoxLayout, QWidget, QVBoxLayout
class minimal_example(QWidget):
def __init__(self):
super().__init__()
self.directory = None
# layout
self.mainwindowlayout = QVBoxLayout()
min_plot = QtWebEngineWidgets.QWebEngineView(self)
x = [1,2,3,4,5]
y = [5,4,3,2,1]
fig = px.line(x=x, y=y)
min_plot.setHtml(
fig.to_html(include_plotlyjs="cdn")
)
self.mainwindowlayout.addWidget(min_plot)
self.setLayout(self.mainwindowlayout)
def main():
app = QApplication(sys.argv)
main = minimal_example()
main.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()When running this, it will return:
js: uncaught ReferenceError: Plotly is not defined.
Metadata
Metadata
Assignees
Labels
No labels