Commit 0cd0aed6 authored by Yori Fournier's avatar Yori Fournier Committed by Yori
Browse files

CHERRY-PICKING: 4b286282

add print_in_notebook function

I am afraid that the as_seen feature won't work since
it seems that they call fig.plot before rendering...
I need to dig more.
parent f2bda1db
......@@ -716,6 +716,26 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
self._initialize(*args, **kwargs)
self.plot()
# DEBUG --------------------------------------------------------------
def print_debug(self):
class_name = str(self.__class__.__name__)
print('\n' + DBUG + " {0} PARAMETERS: ".format(class_name))
print(SPCE + " Raw data: " + str(self.rawdata))
print(SPCE + " ID the figure: " + str(self.fignum))
print(SPCE + "Size of the figure: " + str(self.FIGSIZE) + ' [inch] \n')
# PRINT IN NOTEBOOK --------------------------------------------------
def print_in_notebook(self, **kwargs):
as_seen = kwargs.get('as_seen', False)
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
canvas = FigureCanvas(self) # set the figures canvas /!\ this will destroy the bounding to a window.
self.bounded_to_win = False
return(self)
# PRINT 2 FILE -------------------------------------------------------
def _print_to_file_local(self, filename, *args, **kwargs):
"""Print the rendered figure into a file.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment