GitHub user agoodm opened a pull request:

    https://github.com/apache/zeppelin/pull/1534

    [WIP]ZEPPELIN-1345 - Create a custom matplotlib backend that natively 
supports inline plotting in a python interpreter cell

    ### What is this PR for?
    This PR is the first of two major steps needed to improve matplotlib 
integration in Zeppelin (ZEPPELIN-1344). The latter, which is a plotting 
backend with fully interactive tools enabled, will be done afterwards in a 
separate PR. This PR specifically for automatically displaying output from 
calls to matplotlib plotting functions inline with each paragraph. Thanks to 
the addition of post-execute hooks (ZEPPELIN-1423), there is no need to call 
any `show()` function to display an inline plot, just like in Jupyter.
    
    ### What type of PR is it?
    Improvement
    
    ### Todos
    The main code has been written and anyone who reads this is encouraged to 
test it, but there are a few minor todos:
    * [ ] - Add unit tests
    * [ ] - Add documentation
    * [ ] - Add screenshot showing iterative plotting with angular mode
    
    ### What is the Jira issue?
    [ZEPPELIN-1345](https://issues.apache.org/jira/browse/ZEPPELIN-1345)
    
    ### How should this be tested?
    In a pyspark or python paragraph, enter and run
    ```python
    import matplotlib.pyplot as plt
    plt.plot([1, 2, 3])
    ```
    The plot should be displayed automatically without calling any `show()` 
function whatsoever. A special method called `configure_mpl()` can also be used 
to modify the inline plotting behavior. For example,
    
    ```python
    z.configure_mpl(close=False, angular=True)
    plt.plot([1, 2, 3])
    ```
    allows for iterative updates to the plot provided you have PY4J installed 
for your python installation (which of course is always the case if you use 
pypsark). Doing something like:
    ```
    plt.plot([3, 2, 1])
    ```
    will update the plot that was generated by the previous paragraph by 
leveraging Zeppelin's Angular Display System. However, by setting 
`close=False`, matplotlib will no longer automatically close figures so it is 
now up to the user to explicitly close each figure instance they create. 
There's quite a bit more options for `z.configure_mpl()`, but I will save that 
discussion for the documentation.
    
    ### Screenshots (if appropriate)
    TODO
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? Yes


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/agoodm/zeppelin ZEPPELIN-1345

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zeppelin/pull/1534.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1534
    
----
commit fbc41c196823f0274f1a64011eb6581f6154547f
Author: Alex Goodman <ago...@users.noreply.github.com>
Date:   2016-10-05T22:26:14Z

    Add new matplotlib backend for python/pyspark interpreters

commit ced636d1b96f4a566bf46e4b35bbabfa511ae146
Author: Alex Goodman <ago...@users.noreply.github.com>
Date:   2016-10-06T22:16:59Z

    Added support for Angular Display System

commit c5bcbcceb89e6daf3fdf484589c0aed8efe8d7ae
Author: Alex Goodman <ago...@users.noreply.github.com>
Date:   2016-10-06T23:40:54Z

    Removed unused variable

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to