PY-49055 SciView(fix): Unable to show large plots in PyCharm with sciview.

GitOrigin-RevId: 22b75d6421d69b00123ea50605eca65cdb573b3a
This commit is contained in:
Nikita.Ashihmin
2024-05-22 03:10:07 +04:00
committed by intellij-monorepo-bot
parent 22fac7715b
commit acfac29e86

View File

@@ -1,4 +1,6 @@
import base64
import io
import matplotlib
import os
import sys
@@ -79,10 +81,11 @@ class FigureCanvasInterAgg(FigureCanvasAgg):
def show(self):
FigureCanvasAgg.draw(self)
if matplotlib.__version__ < '1.2':
buffer = self.tostring_rgb(0, 0)
else:
buffer = self.tostring_rgb()
buf = io.BytesIO()
self.print_png(buf)
buf.seek(0)
buffer = buf.read()
buf.close()
if len(set(buffer)) <= 1:
# do not plot empty