{"action":"created","issue":{"url":"https://api.github.com/repos/apache/zeppelin/issues/1329","repository_url":"https://api.github.com/repos/apache/zeppelin","labels_url":"https://api.github.com/repos/apache/zeppelin/issues/1329/labels{/name}","comments_url":"https://api.github.com/repos/apache/zeppelin/issues/1329/comments","events_url":"https://api.github.com/repos/apache/zeppelin/issues/1329/events","html_url":"https://github.com/apache/zeppelin/pull/1329","id":170970588,"number":1329,"title":"ZEPPELIN-1318 - Add support for matplotlib displaying png images in python interpreter","user":{"login":"agoodm","id":5179430,"avatar_url":"https://avatars.githubusercontent.com/u/5179430?v=3","gravatar_id":"","url":"https://api.github.com/users/agoodm","html_url":"https://github.com/agoodm","followers_url":"https://api.github.com/users/agoodm/followers","following_url":"https://api.github.com/users/agoodm/following{/other_user}","gists_url":"https://api.github.com/users/agoodm/gists{/gist_id}","starred_url":"https://api.github.com/users/agoodm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoodm/subscriptions","organizations_url":"https://api.github.com/users/agoodm/orgs","repos_url":"https://api.github.com/users/agoodm/repos","events_url":"https://api.github.com/users/agoodm/events{/privacy}","received_events_url":"https://api.github.com/users/agoodm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-12T22:24:58Z","updated_at":"2016-08-13T01:20:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/zeppelin/pulls/1329","html_url":"https://github.com/apache/zeppelin/pull/1329","diff_url":"https://github.com/apache/zeppelin/pull/1329.diff","patch_url":"https://github.com/apache/zeppelin/pull/1329.patch"},"body":"### What is this PR for?\r\nThis PR adds support for plotting png images using the matplotlib helper function within a python interpreter (eg `z.show()`). The primary motivation for this is due to the overhead incurred from svg images, which can lag the notebooks if multiple, complicated images are generated (for example, multiple filled contour plots). png images are more lightweight, but of course come at a cost of image quality due to them being raster rather than vector like svg. The support for png images is incorporated through the use of a new optional argument to `z.show` called `fmt` which can be one of `'svg'` or `'png'`. The same code that is currently used in show is used for svg images while the code for png images relies on converting the image directly to a byte array and then entering the decoded byte string directly into an HTML image tag. Currently `fmt` defaults to `'png'` but I think we should consider discussing the pros and cons of each option in this PR. \r\n\r\n### What type of PR is it?\r\nImprovement\r\n\r\n### What is the Jira issue?\r\n[ZEPPELIN-1318](https://issues.apache.org/jira/browse/ZEPPELIN-1318)\r\n\r\n### How should this be tested?\r\nIn a notebook cell, enter:\r\n```python\r\n%python\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\n\r\nplt.figure()\r\nplt.plot(np.arange(10))\r\nz.show(plt, fmt=fmt)\r\n```\r\nWhere `fmt` may be one of `'svg'` or `'png'`, and any other input should result in a `ValueError`. I would also recommend testing the example in the screenshot below. \r\n\r\n### Screenshots (if appropriate)\r\n![zeppelin plot](https://puu.sh/qzc4t/b8fcfe856e.png)\r\n\r\n### Questions:\r\n* Does the licenses files need update? No\r\n* Is there breaking changes for older versions? No\r\n* Does this needs documentation? Yes (if the changes to the `help()` docstring are not sufficient)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/zeppelin/issues/comments/239593390","html_url":"https://github.com/apache/zeppelin/pull/1329#issuecomment-239593390","issue_url":"https://api.github.com/repos/apache/zeppelin/issues/1329","id":239593390,"user":{"login":"agoodm","id":5179430,"avatar_url":"https://avatars.githubusercontent.com/u/5179430?v=3","gravatar_id":"","url":"https://api.github.com/users/agoodm","html_url":"https://github.com/agoodm","followers_url":"https://api.github.com/users/agoodm/followers","following_url":"https://api.github.com/users/agoodm/following{/other_user}","gists_url":"https://api.github.com/users/agoodm/gists{/gist_id}","starred_url":"https://api.github.com/users/agoodm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoodm/subscriptions","organizations_url":"https://api.github.com/users/agoodm/orgs","repos_url":"https://api.github.com/users/agoodm/repos","events_url":"https://api.github.com/users/agoodm/events{/privacy}","received_events_url":"https://api.github.com/users/agoodm/received_events","type":"User","site_admin":false},"created_at":"2016-08-13T01:20:13Z","updated_at":"2016-08-13T01:20:13Z","body":"@felixcheung Done."}}
{"actor":{"display_login":"agoodm"}}