Warning, /education/cantor/src/backends/python/graphic_packages.xml is written in an unsupported language. File is not indexed.

0001 <GraphicPackages>
0002     <GraphicPackage>
0003         <Id>matplotlib</Id>
0004         <Name>Matplotlib</Name>
0005         <TestPresenceCommand>
0006 try:
0007     import matplotlib
0008     print(1)
0009 except ModuleNotFoundError:
0010     print(0)
0011         </TestPresenceCommand>
0012         <EnableCommand>
0013 from matplotlib import pyplot as __cantor_plt__;
0014 __cantor_plot_prefix__ = '%1'
0015 
0016 def __cantor_matplotlib_show__():
0017     global __cantor_plot_global_counter__
0018     __cantor_plt_filename__ = __cantor_plot_prefix__ + str(__cantor_plot_global_counter__)
0019     __cantor_plot_global_counter__ += 1
0020     __cantor_plt__.savefig(__cantor_plt_filename__)
0021     print('\nINNER PLOT INFO CANTOR: ', __cantor_plt_filename__, sep='')
0022     __cantor_plt__.clf();
0023 
0024 __cantor_matplotlib_original_show__ = matplotlib.pyplot.show
0025 __cantor_plt__.show = __cantor_matplotlib_show__
0026         </EnableCommand>
0027         <DisableCommand>
0028 __cantor_plt__.show = __cantor_matplotlib_original_show__;
0029         </DisableCommand>
0030         <ToFileCommandTemplate></ToFileCommandTemplate>
0031         <PlotPrecenseKeywords></PlotPrecenseKeywords>
0032     </GraphicPackage>
0033 
0034     <GraphicPackage>
0035         <Id>plotly</Id>
0036         <Name>Plot.ly</Name>
0037         <TestPresenceCommand>
0038 def __cantor_plotly_check_presence__():
0039     import matplotlib;
0040     import sys
0041     import subprocess
0042 
0043     output = subprocess.check_output(['orca', '--help'], shell=True)
0044     output_str = output.decode(sys.stdout.encoding)
0045     is_needed_orca = output_str.find('Plotly\'s image-exporting utilities') != -1
0046     print(1 if is_needed_orca else 0)
0047 
0048 try:
0049    __cantor_plotly_check_presence__()
0050 except ModuleNotFoundError:
0051     print(0)
0052         </TestPresenceCommand>
0053         <EnableCommand>
0054 import plotly as __cantor_plotly__
0055 __cantor_plot_prefix__ = '%1'
0056 def __cantor_plotly_show__(figure):
0057     global __cantor_plot_global_counter__
0058     __cantor_plt_filename__ = __cantor_plot_prefix__ + str(__cantor_plot_global_counter__) + '.png'
0059     __cantor_plot_global_counter__ += 1
0060     figure.write_image(__cantor_plt_filename__, scale=2)
0061     print('\nINNER PLOT INFO CANTOR: ', __cantor_plt_filename__, sep='')
0062 
0063 if hasattr(__cantor_plotly__, 'basedatatypes'):
0064     __cantor_plotly_original_show__ = __cantor_plotly__.basedatatypes.BaseFigure.show
0065     __cantor_plotly__.basedatatypes.BaseFigure.show = __cantor_plotly_show__
0066 else:
0067     __cantor_plotly_original_show__ = __cantor_plotly__.graph_objects.Figure.show
0068     __cantor_plotly__.graph_objects.Figure.show = __cantor_plotly_show__
0069         </EnableCommand>
0070         <DisableCommand>
0071 __cantor_plotly__.basedatatypes.BaseFigure.show = __cantor_plotly_original_show__;
0072         </DisableCommand>
0073         <ToFileCommandTemplate></ToFileCommandTemplate>
0074         <PlotPrecenseKeywords></PlotPrecenseKeywords>
0075     </GraphicPackage>
0076 </GraphicPackages>