plotly-chart-generator


Nameplotly-chart-generator JSON
Version 0.4.0 PyPI version JSON
download
home_page
SummaryQuickly display basic Plotly charts based on data inside a Pandas dataframe.
upload_time2023-08-21 08:40:33
maintainer
docs_urlNone
authorPreben Hesvik
requires_python>=3.11,<4.0
license"MIT"
keywords chart plotly pandas
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ======================
Plotly Chart Generator
======================
.. image:: https://img.shields.io/pypi/l/plotly_chart_generator   :alt: PyPI - License

Description
-----------
This package allows the user to quickly generate plotly charts with customized
styling and formatting from Pandas dataframes and other data structures with as
little as one line of code.

The following chart types can be created:

* Bar charts (from dataframe)
* Line charts (from dataframe)
* Scatter charts (from dictionary)
* Pie charts (from lists, numpy arrays, Pandas series)
* Histograms (from lists, numpy arrays, Pandas series)
* Dot charts (from dataframe)
* Box charts (from lists, numpy arrays, Pandas series)
* Sunburst charts (from lists, numpy arrays, Pandas series)
* Scatter charts subplots (from dictionary)
* Pie chats subplots (from dictionary)

Chart examples are available at https://github.com/PrebenHesvik/Plotly-Chart-Generator


Installation
------------

.. code:: python

    pip install plotly_chart_generator

Usage
-----
.. code:: python

    from plotly_chart_generator.display_chart import display_chart
    from plotly_chart_generator.bar_chart import bar_chart 
    from plotly_chart_generator.chart_styles import chart_styles

    # create data
    index = ['Product A', 'Product B', 'Product C']
    values = {'Products': [37.5, 40.2, 27.8]}
    data = pd.DataFrame(data=values, index=index).transpose()


    # layout
    layout = chart_styles(
        width=500, 
        height=600,
        title='Product sales (millions)', 
        title_size=16, 
        xaxis_ticksize=14)

    # set colors
    idmax = data.idxmax(axis=1)[0]
    max_val_idx = data.columns.get_loc(idmax)
    colors = ['lightslategray',] * len(data.values[0])
    colors[max_val_idx] = 'crimson'

    # traces
    traces = bar_chart(
        df=data,
        bar_width=0.4, 
        textpos='inside', 
        linewidth=1, 
        marker_color=colors)


    display_chart(traces=traces, layout=layout) 

Disclaimer
----------
Most of the descriptions of arguments have been copied form the Plotly Figure
Reference Guide at https://plotly.com/python/reference/
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "plotly-chart-generator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "Chart,Plotly,Pandas",
    "author": "Preben Hesvik",
    "author_email": "prebenhesvik@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/62/f5/6717ecc9ccb543645adf36929973388e98da85c9757bac060253178cbc07/plotly_chart_generator-0.4.0.tar.gz",
    "platform": null,
    "description": "======================\nPlotly Chart Generator\n======================\n.. image:: https://img.shields.io/pypi/l/plotly_chart_generator   :alt: PyPI - License\n\nDescription\n-----------\nThis package allows the user to quickly generate plotly charts with customized\nstyling and formatting from Pandas dataframes and other data structures with as\nlittle as one line of code.\n\nThe following chart types can be created:\n\n* Bar charts (from dataframe)\n* Line charts (from dataframe)\n* Scatter charts (from dictionary)\n* Pie charts (from lists, numpy arrays, Pandas series)\n* Histograms (from lists, numpy arrays, Pandas series)\n* Dot charts (from dataframe)\n* Box charts (from lists, numpy arrays, Pandas series)\n* Sunburst charts (from lists, numpy arrays, Pandas series)\n* Scatter charts subplots (from dictionary)\n* Pie chats subplots (from dictionary)\n\nChart examples are available at https://github.com/PrebenHesvik/Plotly-Chart-Generator\n\n\nInstallation\n------------\n\n.. code:: python\n\n    pip install plotly_chart_generator\n\nUsage\n-----\n.. code:: python\n\n    from plotly_chart_generator.display_chart import display_chart\n    from plotly_chart_generator.bar_chart import bar_chart \n    from plotly_chart_generator.chart_styles import chart_styles\n\n    # create data\n    index = ['Product A', 'Product B', 'Product C']\n    values = {'Products': [37.5, 40.2, 27.8]}\n    data = pd.DataFrame(data=values, index=index).transpose()\n\n\n    # layout\n    layout = chart_styles(\n        width=500, \n        height=600,\n        title='Product sales (millions)', \n        title_size=16, \n        xaxis_ticksize=14)\n\n    # set colors\n    idmax = data.idxmax(axis=1)[0]\n    max_val_idx = data.columns.get_loc(idmax)\n    colors = ['lightslategray',] * len(data.values[0])\n    colors[max_val_idx] = 'crimson'\n\n    # traces\n    traces = bar_chart(\n        df=data,\n        bar_width=0.4, \n        textpos='inside', \n        linewidth=1, \n        marker_color=colors)\n\n\n    display_chart(traces=traces, layout=layout) \n\nDisclaimer\n----------\nMost of the descriptions of arguments have been copied form the Plotly Figure\nReference Guide at https://plotly.com/python/reference/",
    "bugtrack_url": null,
    "license": "\"MIT\"",
    "summary": "Quickly display basic Plotly charts based on data inside a Pandas dataframe.",
    "version": "0.4.0",
    "project_urls": null,
    "split_keywords": [
        "chart",
        "plotly",
        "pandas"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ccc52cd598ca69cc1b5234aa6aa8f73e09a19d13f227d8483e9a07e912144315",
                "md5": "8536a08881949a830aa788f83ec39ea9",
                "sha256": "cc3fdb5391fecb7fa4e74a9e3cbd083a5db1359130fc6944ab73ea3f3126d563"
            },
            "downloads": -1,
            "filename": "plotly_chart_generator-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8536a08881949a830aa788f83ec39ea9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 24444,
            "upload_time": "2023-08-21T08:40:32",
            "upload_time_iso_8601": "2023-08-21T08:40:32.479713Z",
            "url": "https://files.pythonhosted.org/packages/cc/c5/2cd598ca69cc1b5234aa6aa8f73e09a19d13f227d8483e9a07e912144315/plotly_chart_generator-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "62f56717ecc9ccb543645adf36929973388e98da85c9757bac060253178cbc07",
                "md5": "1b41a51125b0518bd17ca8d648b02058",
                "sha256": "7788083cab75563a921c690b81586be6c47f9269de2ca8f852cb02799b46dd6c"
            },
            "downloads": -1,
            "filename": "plotly_chart_generator-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1b41a51125b0518bd17ca8d648b02058",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 16051,
            "upload_time": "2023-08-21T08:40:33",
            "upload_time_iso_8601": "2023-08-21T08:40:33.763749Z",
            "url": "https://files.pythonhosted.org/packages/62/f5/6717ecc9ccb543645adf36929973388e98da85c9757bac060253178cbc07/plotly_chart_generator-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-21 08:40:33",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "plotly-chart-generator"
}
        
Elapsed time: 0.10431s