Python数据分析:基于Plotly的动态可视化绘图
上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人

1.8 查看帮助

查看帮助的操作很简单,只需要如下简单的两行代码。

        # 使用在线绘图查看帮助的方法
        import plotly.plotly as py
        help(py.plot)

对于使用Jupyter Notebook的读者,可以使用如下代码查看帮助。

        # 使用Jupyter Notebook在线绘图查看帮助的方法
        import plotly.plotly as py
        help(py.iplot)

对于离线绘图模式,有如下两种查看帮助的方法。

        # 使用离线绘图查看帮助的方法
        import plotly
        help(plotly.offline.plot)
        # 使用Jupyter Notebook离线绘图查看帮助的方法
        import plotly
        help(plotly.offline.iplot)

其中一个查看帮助的结果代码如下。

        Signature: plotly.offline.iplot(figure_or_data, show_link=True,
    link_text='Export to plot.ly', validate=True, image=None, filename=
    'plot_image', image_width=800, image_height=600, config=None)Docstring:
        Draw plotly graphs inside an IPython or Jupyter notebook without
        connecting to an external server.
        To save the chart to Plotly Cloud or Plotly Enterprise, use
        'plotly.plotly.iplot'.
        To embed an image of the chart, use 'plotly.image.ishow'.
        figure_or_data -- a plotly.graph_objs.Figure or plotly.graph_objs.Data
    or
                        dict or list that describes a Plotly graph.
                        See https://plot.ly/python/ for examples of
                        graph descriptions.
    Keyword arguments:
    show_link (default=True) -- display a link in the bottom-right corner of
                            of the chart that will export the chart to
                            Plotly Cloud or Plotly Enterprise
    link_text (default='Export to plot.ly') -- the text of export link
    validate (default=True) -- validate that all of the keys in the figure
                            are valid? omit if your version of plotly.js
                            has become outdated with your version of
                            graph_reference.json or if you need to include
                            extra, unnecessary keys in your figure.
    image (default=None |'png' |'jpeg' |'svg' |'webp') -- This parameter sets
        the format of the image to be downloaded, if we choose to download
an
        image. This parameter has a default value of None indicating that no
        image should be downloaded. Please note: for higher resolution images
        and more export options, consider making requests to our image servers.
        Type: 'help(py.image)' for more details.
    filename (default='plot') -- Sets the name of the file your image
        will be saved to. The extension should not be included.
    image_height (default=600) -- Specifies the height of the image in 'px'.
    image_width (default=800) -- Specifies the width of the image in 'px'.
    config (default=None) -- Plot view options dictionary. Keyword arguments
        'show_link' and 'link_text' set the associated options in this
        dictionary if it doesn't contain them already.

    Example:
    '''
    from plotly.offline import init_notebook_mode, iplot
    init_notebook_mode()
    iplot([{'x': [1, 2, 3], 'y': [5, 2, 7]}])
    # We can also download an image of the plot by setting the image to the
    format you want. e.g. 'image='png''
    iplot([{'x': [1, 2, 3], 'y': [5, 2, 7]}], image='png')
    '''File:     d:\anaconda3\lib\site-packages\plotly\offline\offline.
pyType:     function