bfstyle


Namebfstyle JSON
Version 0.7.4 PyPI version JSON
download
home_pagehttps://github.com/ignacio365/BF_plots
SummaryLibrería de estilo plots Brain Food
upload_time2023-10-24 19:40:39
maintainer
docs_urlNone
authorJ. Ignacio del Rio
requires_python
licenseMIT
keywords brainfood style plot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Brain Food Style Library

This library contains details for using the Brain Food style library with graphics developed using the Seaborn library in Python.

The library includes four functions:

- `set_bf_style`: Function to set the Brain Food style for graphics.
- `set_bf_palette`: Function to set the Brain Food color palette.
- `select_color`: Function to select a color from the color palette.
- `generate_gradient_colors`: Function to generate a list of gradient colors based on a base color.

Additionally, the library allows you to load the color list into `colors`.
## Usage
### Initial Setup

First, you need to install the bfstyle library.

*Apply this step only if the library has not been installed previously.*


```
pip install bfstyle
```

To use the mentioned functions and the Brain Food color list, you only need to use the following code:

```
import bfstyle
from bfstyle.load_bf_style import colors, set_bf_style, set_bf_palette, select_color, generate_gradient_colors
```



*It is recommended to apply this step at the beginning of your notebook. Also, make sure to import the `seaborn` and 
`matplotlib` libraries.*

Next, apply the functions as follows:
```
set_bf_style()
set_bf_palette()
```

*Once these three steps are applied, the graphics created using the seaborn and matplotlib libraries will use the Brain Food style.*

*Note that the graphics will use Python's default fonts.*

### Customize Desired Fonts

The `set_bf_style()` function allows you to use fonts that have been downloaded in `.ttf` format; 
you only need to specify the directory where the font files are located. As an example, here's how to set the [Roboto](https://fonts.google.com/specimen/Roboto) 
font for your graphics. All `.ttf` files should be saved in the same folder.

```
font_path = "User/working_directory/fonts"  # Example
set_bf_style(path_fonts=font_path)
```


This only requires that the `set_bf_style()` function be executed with the `path_fonts` parameter.

### Customize Color Palette

The `set_bf_palette` function allows you to set a custom color palette. 
It only requires a list of colors for the desired palette with values in RGB format. 
To apply a new palette, use the following code:


```
new_color_list = ['#FFFFFF', '#000000', '#F12323']  # Example
set_bf_palette(colors=new_color_list)
```


## Other Functions

Below are the uses of two other functions: `select_color` and `generate_gradient_colors`.

As mentioned, `select_color` makes it easy to select a specific color from a list and save the RGB value as a *string* 
in a variable. The function requires a list of colors and the position of the color. Note that the first position in the list corresponds to `1`.

For example, to select the first color from the colors list of the `bfstyle` library, 
which contains the Brain Food colors in RGB format, you can use the following lines of code:

```
colors  # Brain Food colors list
first_color = select_color(colors, 1)  # Stores the RGB color string in first_color
```


When you run the function, it will display the selected color graphically.

Sometimes, you may need a gradient of colors to expand the color palette. 
For this, you only need a base color and the number of colors to generate.

```
base_color = '#B01515'
degrade_color_list = generate_gradient_colors(base_color, 11)
```



This will generate a list of 11 colors based on base_color.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ignacio365/BF_plots",
    "name": "bfstyle",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "brainfood,style,plot",
    "author": "J. Ignacio del Rio",
    "author_email": "jorge.delrio@ug.uchile.cl",
    "download_url": "https://files.pythonhosted.org/packages/a4/79/898faf9786788750fd490fc6bb9b4b7054b8be6b1118ba7d56aad46cc1c7/bfstyle-0.7.4.tar.gz",
    "platform": null,
    "description": "# Brain Food Style Library\r\n\r\nThis library contains details for using the Brain Food style library with graphics developed using the Seaborn library in Python.\r\n\r\nThe library includes four functions:\r\n\r\n- `set_bf_style`: Function to set the Brain Food style for graphics.\r\n- `set_bf_palette`: Function to set the Brain Food color palette.\r\n- `select_color`: Function to select a color from the color palette.\r\n- `generate_gradient_colors`: Function to generate a list of gradient colors based on a base color.\r\n\r\nAdditionally, the library allows you to load the color list into `colors`.\r\n## Usage\r\n### Initial Setup\r\n\r\nFirst, you need to install the bfstyle library.\r\n\r\n*Apply this step only if the library has not been installed previously.*\r\n\r\n\r\n```\r\npip install bfstyle\r\n```\r\n\r\nTo use the mentioned functions and the Brain Food color list, you only need to use the following code:\r\n\r\n```\r\nimport bfstyle\r\nfrom bfstyle.load_bf_style import colors, set_bf_style, set_bf_palette, select_color, generate_gradient_colors\r\n```\r\n\r\n\r\n\r\n*It is recommended to apply this step at the beginning of your notebook. Also, make sure to import the `seaborn` and \r\n`matplotlib` libraries.*\r\n\r\nNext, apply the functions as follows:\r\n```\r\nset_bf_style()\r\nset_bf_palette()\r\n```\r\n\r\n*Once these three steps are applied, the graphics created using the seaborn and matplotlib libraries will use the Brain Food style.*\r\n\r\n*Note that the graphics will use Python's default fonts.*\r\n\r\n### Customize Desired Fonts\r\n\r\nThe `set_bf_style()` function allows you to use fonts that have been downloaded in `.ttf` format; \r\nyou only need to specify the directory where the font files are located. As an example, here's how to set the [Roboto](https://fonts.google.com/specimen/Roboto) \r\nfont for your graphics. All `.ttf` files should be saved in the same folder.\r\n\r\n```\r\nfont_path = \"User/working_directory/fonts\"  # Example\r\nset_bf_style(path_fonts=font_path)\r\n```\r\n\r\n\r\nThis only requires that the `set_bf_style()` function be executed with the `path_fonts` parameter.\r\n\r\n### Customize Color Palette\r\n\r\nThe `set_bf_palette` function allows you to set a custom color palette. \r\nIt only requires a list of colors for the desired palette with values in RGB format. \r\nTo apply a new palette, use the following code:\r\n\r\n\r\n```\r\nnew_color_list = ['#FFFFFF', '#000000', '#F12323']  # Example\r\nset_bf_palette(colors=new_color_list)\r\n```\r\n\r\n\r\n## Other Functions\r\n\r\nBelow are the uses of two other functions: `select_color` and `generate_gradient_colors`.\r\n\r\nAs mentioned, `select_color` makes it easy to select a specific color from a list and save the RGB value as a *string* \r\nin a variable. The function requires a list of colors and the position of the color. Note that the first position in the list corresponds to `1`.\r\n\r\nFor example, to select the first color from the colors list of the `bfstyle` library, \r\nwhich contains the Brain Food colors in RGB format, you can use the following lines of code:\r\n\r\n```\r\ncolors  # Brain Food colors list\r\nfirst_color = select_color(colors, 1)  # Stores the RGB color string in first_color\r\n```\r\n\r\n\r\nWhen you run the function, it will display the selected color graphically.\r\n\r\nSometimes, you may need a gradient of colors to expand the color palette. \r\nFor this, you only need a base color and the number of colors to generate.\r\n\r\n```\r\nbase_color = '#B01515'\r\ndegrade_color_list = generate_gradient_colors(base_color, 11)\r\n```\r\n\r\n\r\n\r\nThis will generate a list of 11 colors based on base_color.\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Librer\u00eda de estilo plots Brain Food",
    "version": "0.7.4",
    "project_urls": {
        "Download": "https://github.com/ignacio365/BF_plots/tarball/0.5",
        "Homepage": "https://github.com/ignacio365/BF_plots"
    },
    "split_keywords": [
        "brainfood",
        "style",
        "plot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a479898faf9786788750fd490fc6bb9b4b7054b8be6b1118ba7d56aad46cc1c7",
                "md5": "87b7503d9849c8eb9ec32ca3c784e9d2",
                "sha256": "efc63559c6ba52bb27d31b62867619833944228eacc6d929855fc3ce561935b5"
            },
            "downloads": -1,
            "filename": "bfstyle-0.7.4.tar.gz",
            "has_sig": false,
            "md5_digest": "87b7503d9849c8eb9ec32ca3c784e9d2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3678,
            "upload_time": "2023-10-24T19:40:39",
            "upload_time_iso_8601": "2023-10-24T19:40:39.965708Z",
            "url": "https://files.pythonhosted.org/packages/a4/79/898faf9786788750fd490fc6bb9b4b7054b8be6b1118ba7d56aad46cc1c7/bfstyle-0.7.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-24 19:40:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ignacio365",
    "github_project": "BF_plots",
    "github_not_found": true,
    "lcname": "bfstyle"
}
        
Elapsed time: 0.26707s