# mpltable
`mpltable` is a Python library that makes it easy to create and customize tables using matplotlib. It provides a simple `Table` class that can be used to draw tables on a given `Axes` object. This library offers various customization options such as column width, cell and header styles, title, separators, and border options.
## Installation
To install mpltable, run the following command:
```
pip install mpltable
```
## Usage
Below is a quick example of using mpltable to create a simple table.
```python
import pandas as pd
import matplotlib.pyplot as plt
from mpltable import Table
# Sample data
data = pd.DataFrame({
'A': [1, 2, 3],
'B': [4, 5, 6],
'C': [7, 8, 9]
})
# Create a table with the data
fig, ax = plt.subplots()
table = Table(data, ax)
table.draw()
plt.show()
```
## Features
The `Table` class in mpltable provides several features for customizing your table:
- `show_column_names`: Display or hide column names in the table (default: `True`).
- `col_widths`: Set the column widths (default: equal width for all columns).
- `col_header_options`: Customize the appearance of the column headers.
- `cell_options`: Customize the appearance of the table cells.
- `table_title`: Set the table title (default: `None`).
- `title_options`: Customize the appearance and position of the table title.
- `background_color`: Set the background color of the table (default: `None`).
- `header_separator_kwargs`: Customize the separator line between header and data rows.
- `column_separator_kwargs`: Customize the separator lines between columns.
- `row_separator_kwargs`: Customize the separator lines between rows.
- `border_options`: Customize the appearance of the table borders.
### col_header_options
You can pass in a dictionary with the following settings
- `text_kwargs`: A dictionary of keyword arguments to pass to the text rendering function for the column headers.
- `padding`: A float between 0 and 1 indicating the amount of padding to add around the text in each column header as a fraction of the height of the column header.
- `alignment`: A string indicating the horizontal alignment of the text in each column header, either "left", "center", or "right".
- `extend_column_separator`: A boolean indicating whether the column separator lines should extend through the column headers.
### cell_options
You can pass in a dictionary with the following settings
- `text_kwargs`: A dictionary of keyword arguments to pass to the text rendering function for the cells.
- `padding`: A float between 0 and 1 indicating the amount of padding to add around the text in each cell as a fraction of the height of the cell.
- `alignment`: A string indicating the horizontal alignment of the text in each cell, either "left", "center", or "right".
### title_options
You can pass in a dictionary with the following settings
- `text_kwargs`: A dictionary of keyword arguments to pass to the text rendering function for the table title.
- `padding`: A float between 0 and 1 indicating the amount of padding to add around the text in the table title as a fraction of the height of the table title.
- `alignment`: A string indicating the horizontal alignment of the text in the table title, either "left", "center", or "right".
- `position`: A string indicating the position of the table title, either "top" or "bottom".
- `height`: A float between 0 and 1 indicating the height of the table title as a fraction of the height of the table.
- `separator_kwargs`: A dictionary of keyword arguments to pass to the line rendering function for the separator line between the table title and the table.
### border_options
You can pass in a dictionary with the following settings
- `bottom`: a dictionary of keyword arguments to pass to the line rendering function for the bottom border of the table.
- `top`: a dictionary of keyword arguments to pass to the line rendering function for the top border of the table.
- `left`: a dictionary of keyword arguments to pass to the line rendering function for the left border of the table.
- `right`: a dictionary of keyword arguments to pass to the line rendering function for the right border of the table.
Once the `Table` object has been instantiated, all these are converted into dataclasses and can be modified directly
before calling the `draw` method. For example, to change the column widths, you can do the following:
```python
table.col_widths = [0.2, 0.3, 0.5]
table.draw()
```
For more examples and detailed usage instructions, please refer to the [documentation](https://github.com/yourusername/mpltable/blob/main/docs/README.md).
## License
mpltable is released under the [MIT License](https://github.com/yourusername/mpltable/blob/main/LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/dmoggles/matplotlib_table",
"name": "matplotlib-table",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Dmitry Mogilevsky",
"author_email": "dmitry.mogilevsky@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fb/34/6f4dfcdd90aab3a1d024a69e0b756ae293bf2b3dfd04807fd792327f17c1/matplotlib_table-0.0.2.tar.gz",
"platform": null,
"description": "# mpltable\n\n`mpltable` is a Python library that makes it easy to create and customize tables using matplotlib. It provides a simple `Table` class that can be used to draw tables on a given `Axes` object. This library offers various customization options such as column width, cell and header styles, title, separators, and border options.\n\n## Installation\n\nTo install mpltable, run the following command:\n\n```\npip install mpltable\n```\n\n## Usage\n\nBelow is a quick example of using mpltable to create a simple table.\n\n```python\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom mpltable import Table\n\n# Sample data\ndata = pd.DataFrame({\n 'A': [1, 2, 3],\n 'B': [4, 5, 6],\n 'C': [7, 8, 9]\n})\n\n# Create a table with the data\nfig, ax = plt.subplots()\ntable = Table(data, ax)\ntable.draw()\n\nplt.show()\n```\n\n## Features\n\nThe `Table` class in mpltable provides several features for customizing your table:\n\n- `show_column_names`: Display or hide column names in the table (default: `True`).\n- `col_widths`: Set the column widths (default: equal width for all columns).\n- `col_header_options`: Customize the appearance of the column headers.\n- `cell_options`: Customize the appearance of the table cells.\n- `table_title`: Set the table title (default: `None`).\n- `title_options`: Customize the appearance and position of the table title.\n- `background_color`: Set the background color of the table (default: `None`).\n- `header_separator_kwargs`: Customize the separator line between header and data rows.\n- `column_separator_kwargs`: Customize the separator lines between columns.\n- `row_separator_kwargs`: Customize the separator lines between rows.\n- `border_options`: Customize the appearance of the table borders.\n\n### col_header_options\nYou can pass in a dictionary with the following settings\n- `text_kwargs`: A dictionary of keyword arguments to pass to the text rendering function for the column headers.\n- `padding`: A float between 0 and 1 indicating the amount of padding to add around the text in each column header as a fraction of the height of the column header.\n- `alignment`: A string indicating the horizontal alignment of the text in each column header, either \"left\", \"center\", or \"right\".\n- `extend_column_separator`: A boolean indicating whether the column separator lines should extend through the column headers.\n\n### cell_options\nYou can pass in a dictionary with the following settings\n- `text_kwargs`: A dictionary of keyword arguments to pass to the text rendering function for the cells.\n- `padding`: A float between 0 and 1 indicating the amount of padding to add around the text in each cell as a fraction of the height of the cell.\n- `alignment`: A string indicating the horizontal alignment of the text in each cell, either \"left\", \"center\", or \"right\".\n\n### title_options\nYou can pass in a dictionary with the following settings\n- `text_kwargs`: A dictionary of keyword arguments to pass to the text rendering function for the table title.\n- `padding`: A float between 0 and 1 indicating the amount of padding to add around the text in the table title as a fraction of the height of the table title.\n- `alignment`: A string indicating the horizontal alignment of the text in the table title, either \"left\", \"center\", or \"right\".\n- `position`: A string indicating the position of the table title, either \"top\" or \"bottom\".\n- `height`: A float between 0 and 1 indicating the height of the table title as a fraction of the height of the table.\n- `separator_kwargs`: A dictionary of keyword arguments to pass to the line rendering function for the separator line between the table title and the table.\n\n### border_options\nYou can pass in a dictionary with the following settings\n- `bottom`: a dictionary of keyword arguments to pass to the line rendering function for the bottom border of the table.\n- `top`: a dictionary of keyword arguments to pass to the line rendering function for the top border of the table.\n- `left`: a dictionary of keyword arguments to pass to the line rendering function for the left border of the table.\n- `right`: a dictionary of keyword arguments to pass to the line rendering function for the right border of the table.\n\n\nOnce the `Table` object has been instantiated, all these are converted into dataclasses and can be modified directly \nbefore calling the `draw` method. For example, to change the column widths, you can do the following:\n\n```python\ntable.col_widths = [0.2, 0.3, 0.5]\ntable.draw()\n```\n\nFor more examples and detailed usage instructions, please refer to the [documentation](https://github.com/yourusername/mpltable/blob/main/docs/README.md).\n\n## License\n\nmpltable is released under the [MIT License](https://github.com/yourusername/mpltable/blob/main/LICENSE).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Create prettier tables in matplotlib",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/dmoggles/matplotlib_table"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7016d65d56dc27cf8ad0ae6e119e4e7ea6edd63606ac0f84c8eb98bcd7177cec",
"md5": "676cf401ed69fc3fae31d7685394293e",
"sha256": "09f4f8b8912d0917bd544d80c2ed486c271c7b467501ea584913312765fbdcf8"
},
"downloads": -1,
"filename": "matplotlib_table-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "676cf401ed69fc3fae31d7685394293e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7958,
"upload_time": "2023-05-05T00:54:13",
"upload_time_iso_8601": "2023-05-05T00:54:13.195714Z",
"url": "https://files.pythonhosted.org/packages/70/16/d65d56dc27cf8ad0ae6e119e4e7ea6edd63606ac0f84c8eb98bcd7177cec/matplotlib_table-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fb346f4dfcdd90aab3a1d024a69e0b756ae293bf2b3dfd04807fd792327f17c1",
"md5": "e664636d131c77b365d18e4b2da6ea08",
"sha256": "b341c9bfd63e30c21d941b36dbcbfd867720463b4dd03bb3ae3ceee3c49e214a"
},
"downloads": -1,
"filename": "matplotlib_table-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "e664636d131c77b365d18e4b2da6ea08",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 12669,
"upload_time": "2023-05-05T00:54:14",
"upload_time_iso_8601": "2023-05-05T00:54:14.341874Z",
"url": "https://files.pythonhosted.org/packages/fb/34/6f4dfcdd90aab3a1d024a69e0b756ae293bf2b3dfd04807fd792327f17c1/matplotlib_table-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-05 00:54:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dmoggles",
"github_project": "matplotlib_table",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "matplotlib-table"
}