tomplotlib


Nametomplotlib JSON
Version 1.2.3 PyPI version JSON
download
home_pagehttps://github.com/TomGeorge1234/tomplotlib
SummaryA package which formats matplotlib plots and contains some other useful functions
upload_time2024-09-28 22:59:08
maintainerNone
docs_urlNone
authorTom George
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI version](https://badge.fury.io/py/tomplotlib.svg)](https://badge.fury.io/py/tomplotlib)


# tomplotlib

`tomplotlib` is Tom's wrapper for `matplotlib`. 
This package will style your plots and define some useful functions, including a function for automated saving of figures labelled by date and time. The main code is found in `./tomplotlib/tpl.py`

<img src="./figs/tomplotlib.png" width="600">

## Installation
To install, run
```
pip install tomplotlib
```
Alternatively, clone this directory and then run:
```
python setup.py install
```
(install in edit mode `pip install -e .` if you wish the edit the code.)

## Importing 
Import ```tomplotlib``` into your code with: /
```
import tomplotlib as tpl 
```
set's most of the required style parameters. 

## Usage

* ```tpl.save_figure(fig)```
This, in my opinion, is the most useful function. By defining a figure directory (```tpl.figure_directory = "where_to_save_my/Figures/"```), you can call ```tpl.save_figure(fig, `figureName`)``` on any `matplotlib` figure or animation object. This will timestamp the figure and save it in the figure directory (which will be made if it doesn't already exist), inside another directory which is the todays days date. By default images will be saved as `.png`s and `.svg`s, If an animation object if passed this will be saved as `'.gif'` and `'.mp4'`. 

```
import tomplotlib as tpl 
tpl.figure_directory = "./Figures/"
fig, ax = #some code which makes a maplotlib figure
tpl.save_figure(fig,"fig_name")
```






* ```tpl.xy_axes(ax)``` 
Tidies the axes, leaving only x and y axes at zero. 


* ```tpl.set_colorscheme(colorscheme)``` sets the colour scheme
```
tpl.set_colorscheme(colorscheme=1)
fig, ax = #some code which makes a matplotlib figure

tpl.set_colorscheme(colorscheme=2)
fig, ax = #some code which makes a matplotlib figure

tpl.set_colorscheme(colorscheme='Set3')
fig, ax = #some code which makes a matplotlib figure

tpl.set_colorscheme(colorscheme=[[0.9,0.9,0.9],[0.75,0.75,0.75],[0.6,0.6,0.6],[0.45,0.45,0.45],[0.3,0.3,0.3],[0.15,0.15,0.15],[0,0,0]])
fig, ax = #some code which makes a matplotlib figure
```
You pass ```colorscheme``` as an ```int``` (schemes I have defined), as ```str``` (matplotlib schemes, see [here](https://matplotlib.org/stable/tutorials/colors/colormaps.html)) or as a ```list``` of colors (e.g. list of hexstrings). These will become C0, C1, C2...

<img src="./figs/colorschemes.png">



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/TomGeorge1234/tomplotlib",
    "name": "tomplotlib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Tom George",
    "author_email": "tom.george.20@ucl.ac.uk",
    "download_url": null,
    "platform": null,
    "description": "[![PyPI version](https://badge.fury.io/py/tomplotlib.svg)](https://badge.fury.io/py/tomplotlib)\n\n\n# tomplotlib\n\n`tomplotlib` is Tom's wrapper for `matplotlib`. \nThis package will style your plots and define some useful functions, including a function for automated saving of figures labelled by date and time. The main code is found in `./tomplotlib/tpl.py`\n\n<img src=\"./figs/tomplotlib.png\" width=\"600\">\n\n## Installation\nTo install, run\n```\npip install tomplotlib\n```\nAlternatively, clone this directory and then run:\n```\npython setup.py install\n```\n(install in edit mode `pip install -e .` if you wish the edit the code.)\n\n## Importing \nImport ```tomplotlib``` into your code with: /\n```\nimport tomplotlib as tpl \n```\nset's most of the required style parameters. \n\n## Usage\n\n* ```tpl.save_figure(fig)```\nThis, in my opinion, is the most useful function. By defining a figure directory (```tpl.figure_directory = \"where_to_save_my/Figures/\"```), you can call ```tpl.save_figure(fig, `figureName`)``` on any `matplotlib` figure or animation object. This will timestamp the figure and save it in the figure directory (which will be made if it doesn't already exist), inside another directory which is the todays days date. By default images will be saved as `.png`s and `.svg`s, If an animation object if passed this will be saved as `'.gif'` and `'.mp4'`. \n\n```\nimport tomplotlib as tpl \ntpl.figure_directory = \"./Figures/\"\nfig, ax = #some code which makes a maplotlib figure\ntpl.save_figure(fig,\"fig_name\")\n```\n\n\n\n\n\n\n* ```tpl.xy_axes(ax)``` \nTidies the axes, leaving only x and y axes at zero. \n\n\n* ```tpl.set_colorscheme(colorscheme)``` sets the colour scheme\n```\ntpl.set_colorscheme(colorscheme=1)\nfig, ax = #some code which makes a matplotlib figure\n\ntpl.set_colorscheme(colorscheme=2)\nfig, ax = #some code which makes a matplotlib figure\n\ntpl.set_colorscheme(colorscheme='Set3')\nfig, ax = #some code which makes a matplotlib figure\n\ntpl.set_colorscheme(colorscheme=[[0.9,0.9,0.9],[0.75,0.75,0.75],[0.6,0.6,0.6],[0.45,0.45,0.45],[0.3,0.3,0.3],[0.15,0.15,0.15],[0,0,0]])\nfig, ax = #some code which makes a matplotlib figure\n```\nYou pass ```colorscheme``` as an ```int``` (schemes I have defined), as ```str``` (matplotlib schemes, see [here](https://matplotlib.org/stable/tutorials/colors/colormaps.html)) or as a ```list``` of colors (e.g. list of hexstrings). These will become C0, C1, C2...\n\n<img src=\"./figs/colorschemes.png\">\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A package which formats matplotlib plots and contains some other useful functions",
    "version": "1.2.3",
    "project_urls": {
        "Homepage": "https://github.com/TomGeorge1234/tomplotlib"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "04420f8166baa155a87ba62e35048337f6ee8c703c89f11249985801d6a919b7",
                "md5": "118c193b090204ae08662c48c9973eae",
                "sha256": "26b04036b0796ac92ffeb3ff2777ad6597d568556aa6c81c56e8961aec16bb7e"
            },
            "downloads": -1,
            "filename": "tomplotlib-1.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "118c193b090204ae08662c48c9973eae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12472,
            "upload_time": "2024-09-28T22:59:08",
            "upload_time_iso_8601": "2024-09-28T22:59:08.768089Z",
            "url": "https://files.pythonhosted.org/packages/04/42/0f8166baa155a87ba62e35048337f6ee8c703c89f11249985801d6a919b7/tomplotlib-1.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-28 22:59:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TomGeorge1234",
    "github_project": "tomplotlib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tomplotlib"
}
        
Elapsed time: 0.43879s