.. _devTest_plots_no_m21: .. WARNING: DO NOT EDIT THIS FILE: AUTOMATICALLY GENERATED. PLEASE EDIT THE .py FILE DIRECTLY. Testing Plotting w/o Music21 ============================ These are tests to see what difference importing music21 does to the current Jupyter/Matplotlib/numpy installation .. code:: ipython3 import matplotlib.pyplot as plt .. code:: ipython3 plt.plot(range(10)) .. parsed-literal:: :class: ipython-result [] .. image:: devTest_plots_no_m21_2_1.png .. code:: ipython3 a = plt.plot(range(10)) .. image:: devTest_plots_no_m21_3_0.png .. code:: ipython3 a .. parsed-literal:: :class: ipython-result [] .. code:: ipython3 from matplotlib.figure import Figure .. code:: ipython3 fig = Figure() .. code:: ipython3 fig .. parsed-literal:: :class: ipython-result
.. code:: ipython3 ax = fig.add_subplot() .. code:: ipython3 fig # note that this would not show anything unless we had already done plt.plot() .. image:: devTest_plots_no_m21_9_0.png .. code:: ipython3 repr(fig) .. parsed-literal:: :class: ipython-result '
' .. code:: ipython3 from IPython import get_ipython # as shell .. code:: ipython3 shell = get_ipython() .. code:: ipython3 formatter = shell.display_formatter formatter .. parsed-literal:: :class: ipython-result .. code:: ipython3 png_formatter = formatter.formatters['image/png'] png_formatter .. parsed-literal:: :class: ipython-result .. code:: ipython3 dir(png_formatter) .. parsed-literal:: :class: ipython-result ['__annotations__', '__call__', '__class__', '__contains__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_add_notifiers', '_all_trait_default_generators', '_check_return', '_config_changed', '_cross_validation_lock', '_defining_class', '_descriptors', '_find_my_config', '_get_trait_default_generator', '_in_deferred_types', '_instance_inits', '_load_config', '_notify_observers', '_notify_trait', '_register_validator', '_remove_notifiers', '_return_type', '_static_immutable_initial_values', '_trait_default_generators', '_trait_notifiers', '_trait_validators', '_trait_values', '_traits', 'add_traits', 'class_config_rst_doc', 'class_config_section', 'class_get_help', 'class_get_trait_help', 'class_own_trait_events', 'class_own_traits', 'class_print_help', 'class_trait_names', 'class_traits', 'config', 'cross_validation_lock', 'deferred_printers', 'enabled', 'for_type', 'for_type_by_name', 'format_type', 'has_trait', 'hold_trait_notifications', 'lookup', 'lookup_by_type', 'notify_change', 'observe', 'on_trait_change', 'parent', 'pop', 'print_method', 'section_names', 'set_trait', 'setup_instance', 'singleton_printers', 'trait_defaults', 'trait_events', 'trait_has_value', 'trait_metadata', 'trait_names', 'trait_values', 'traits', 'type_printers', 'unobserve', 'unobserve_all', 'update_config'] .. code:: ipython3 png_formatter.type_printers .. parsed-literal:: :class: ipython-result {matplotlib.figure.Figure: functools.partial(, fmt='png', base64=True, bbox_inches='tight')} .. code:: ipython3 fig.canvas .. parsed-literal:: :class: ipython-result .. code:: ipython3 fig.canvas.print_figure .. parsed-literal:: :class: ipython-result > .. code:: ipython3 # x = fig.canvas.print_figure('asdf') # will write out a file called asdf.png # x is None