# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['soccerbars']

package_data = \
{'': ['*']}

install_requires = \
['matplotlib>=3.3.3,<4.0.0', 'numpy==1.19.3']

extras_require = \
{'cli': ['click>=7.1.2,<8.0.0',
         'colorama>=0.4.4,<0.5.0',
         'click-help-colors>=0.8,<0.9',
         'pandas>=1.1.5,<2.0.0']}

entry_points = \
{'console_scripts': ['soccerbars = soccerbars.__main__:cli']}

setup_kwargs = {
    'name': 'soccerbars',
    'version': '0.1.0',
    'description': 'Word-sized tallies of association football results using multivariate sparklines based on Gestalt theory (gestaltlines).',
    'long_description': '\n<!-- markdownlint-disable MD033 -->\n# soccerbars <img width="90em" height="24em" src="https://raw.githubusercontent.com/meakbiyik/soccerbars/master/resources/example.png">\n\n<!-- badges: start -->\n[![R CMD check](https://github.com/meakbiyik/soccerbars/workflows/R%20CMD%20check/badge.svg)](https://github.com/meakbiyik/soccerbars/actions)\n[![Python package](https://github.com/meakbiyik/soccerbars/workflows/Python%20package/badge.svg)](https://github.com/meakbiyik/soccerbars/actions)\n<!-- To include when the repo becomes public.\n[![Codecov test coverage](https://codecov.io/gh/meakbiyik/soccerbars/branch/master/graph/badge.svg)](https://codecov.io/gh/meakbiyik/soccerbars?branch=master)\n-->\n<!-- badges: end -->\n\nWord-sized tallies of association football results using multivariate sparklines based on Gestalt theory (gestaltlines).\n\nThis repository contains a Python package, an R package, and a command line tool based on Python.\n\nSoccerbars is created by Prof. Dr. Ulrik Brandes of ETH Zürich and this repository is a port of his [LaTeX package](https://github.com/ubrandes-ethz/soccerbars). An introduction to the theory behind this work can be found [here](https://sn.ethz.ch/research/soccerbars.html).\n\n## Usage\n\nThe signature of the main function `soccerbar` is identical in both Python and R implementations. The input (`scores` argument) can be either a list of matches in the form ```(home_team_score: integer, away_team_score: integer, away_game: boolean)```, a list of three same-length score lists with the same types as the previous scheme, or common data frame objects of each language (`pandas.DataFrame` in Python and `data.frame` in R). A list of these entities can also be given as input if multiple leagues/tournaments are wanted to be plotted.\n\nBoth languages preserve the flags and the `color` arguments from the LaTeX package, and also expose a series of common parameters as keyword arguments. `output_path` and `show` arguments can be used to determine whether the call is to save the resulting image to the given path(s), or just to show it via the available graphical interface (not possible in Python if the function is called from the command line). In both cases, the functions return the plotted objects (`matplotlib.Axes` object(s) in Python and `ggplot` object(s) in R).\n\nFor `color` and `output_path` arguments, the function expects the structure of these to be consistent with the `scores` argument: if multiple lists of match lists are given, then for each such list an output path and a list of colors must be specified, therefore the lengths must be equal in all levels. These arguments are optional, when not provided the configuration will use the LaTeX defaults. Also, the `color` argument should not be necessary in most cases, as the color-related keyword arguments provide sufficient flexibility with much easier usage in both languages (see [Parameters](#parameters) below for more details).\n\n### in Python\n\nGive the matches to the ```soccerbar``` function as an iterable of matches in row-wise, column-wise or DataFrame format. A list of values following these formats (e.g. in the context of multiple leagues) are also accepted without mixing.\n\n```python\nfrom soccerbars import soccerbar\n\n# Row-wise format\nsoccerbar([\n    (1, 2, True), (3, 4, False), (5, 6, True), (7, 8, False)\n])\n# Column-wise format\nsoccerbar([\n    (1, 3, 5, 7), \n    (2, 4, 6, 8), \n    (True, False, True, False)\n], outlined=True, output_path="matches.png")\n# List of row-wise inputs: observe that both color and output_path\n# parameters match with the scores\nsoccerbar([\n    [(1, 2, True), (3, 4, False)], \n    [(5, 6, True), (7, 8, False)]\n    ],\n    color=[("r", "b"), ("g", "y")],\n    output_path=["league1.png", "league2.png"]\n)\n# Input as pandas DataFrame\nimport pandas as pd\n\nsoccerbar(pd.DataFrame([\n    (1, 2, True), (3, 4, False), (5, 6, True), (7, 8, False)\n]), home_color="red")\n```\n\n### in R\n\nSimilarly with its Python counterpart, ```soccerbar``` admits both list of match score lists, and a list of three vectors, along with `data.frame` objects. A list of these (e.g. in the context of multiple leagues) are also allowed.\n\n```R\nlibrary(soccerbars)\n\n# Row-wise format\nsoccerbar(list(\n    list(1, 2, TRUE), list(3, 4, FALSE), list(5, 6, TRUE), list(7, 8, FALSE)\n))\n# Column-wise (vector) format\nsoccerbar(list(\n    c(1, 3, 5, 7),\n    c(2, 4, 6, 8),\n    c(TRUE, FALSE, TRUE, FALSE)\n), outlined = TRUE, output_path = "matches.png")\n# List of column-wise inputs: observe that both color and output_path\n# parameters match with the scores\nsoccerbar(list(\n    list(c(1, 3), c(2, 4), c(TRUE, FALSE)), \n    list(c(5, 7), c(6, 8), c(TRUE, FALSE))\n    ),\n    color = list(c("red", "blue"), c("green", "yellow")),\n    output_path = c("league1.png", "league2.png")\n)\n# Input as data.frame object\nsoccerbar(data.frame(\n    c(1, 3, 5, 7),\n    c(2, 4, 6, 8),\n    c(TRUE, FALSE, TRUE, FALSE)\n), home_color = "red")\n```\n\n### via CLI\n\nAfter installing the package (see the instructions [below](#as-a-command-line-tool)), navigate into the folder and run\n\n```bash\npoetry run soccerbars --help\n```\n\nto see the available options. The CLI is a thin wrapper around the Python API, and writes the output image to the specified location with the `--output-path` argument. Input syntax is identical with the LaTeX package. In addition to the capabilities of the Python core, CLI can also admit a glob pattern to match with `.csv` files.\n\n```bash\n# Vanilla usage\npoetry run soccerbars "(1-2) (3-1)* (2-2)"\n# Specifying the output path (default is "output.png")\npoetry run soccerbars -o out.tiff "(1-2) (3-1)* (2-2)"\n# Reading from a .csv file and specifying an output file\npoetry run soccerbars matches.csv -o matches.pdf\n# Reading from a glob of csv files and saving the output images to a directory\npoetry run soccerbars *.csv -o ".\\output-dir"\n# `-t`, `-z`, `-ol` flags stand for twogoalline, zerodots and outlined options\n# `-p` option can be used to specify additional parameters with syntax key:value\npoetry run soccerbars -z -ol -p fill_color:"(1,1,1,1)" -p home_color:red *.csv\n```\n\n### Parameters\n\nThese parameters can be used to customize the output images in all components.\n\n| Parameter | Description | Default |\n|-|-|-|\n| dpi | Dots per inch resolution | 300 |\n| thickness | Line thickness in cartesian coordinates | 0.36 |\n| edge_thickness  | Edge thickness for outlined patches (when outlined=True) as the ratio to the line thickness | 0.35 |\n| goalless_edge_thickness  | Edge thickness for outlined no-goal patches (when outlined=True) as the ratio to the line thickness | 0.5 |\n| zerodot | Zero-dot diameter ratio to thickness (when zerodots=True) | 0.6 |\n| slant | Slope for unbalanced scores in degrees | 14 |\n| spacing | Spacing between matches in cartesian coordinates | 0.9 |\n| padding | Padding before and after the matches in cartesian coordinates | 0.2 |\n| baseline_factor | Thickness of baseline with respect to line thickness | 0.2 |\n| away_brighter | Set away game colors 33% brighter (when outlined=False) | True |\n| away_darker | Set away game colors 33% darker (when outlined=False, setting this flag will turn "away_brighter" off) | False |\n| transparent_background | Set the background transparent instead of white | False |\n| home_color | Color of home match lines (in Python: matplotlib-acceptable formats, in R: any of the three kinds of R color specifications; either a color name as listed by colors(), a hexadecimal string of the form "#rrggbb" or "#rrggbbaa", or a positive integer i meaning `palette()[i]`) | #000000FF |\n| away_color | Color of away match lines | #000000FF |\n| baseline_color | Color of baselines | #000000FF |\n| fill_color | Fill color for the outlined sparklines | #00000000 |\n| clip_slanted_lines | Clip the ends of the slanted lines | True |\n\n## Installation\n\n### As a Python package\n\n```bash\npip install soccerbars\n```\n\n### As an R package\n\nThis package is not published in CRAN yet, so you need to use the Github installation functionality of `devtools`.\n\n```R\ndevtools::install_github("meakbiyik/soccerbars")\n```\n\n### As a command line tool\n\nAlthough it is possible to use the command line interface after installing the Python package into the current environment and running `python -m soccerbars`, installation as an isolated tool might be preferrable to keep the environment clean. Following steps will create a new environment and install `soccerbars` for this purpose.\n\n1. Install Python from [here](https://www.python.org/downloads/)\n2. Install [Poetry](https://python-poetry.org/), a dependency management tool for Python, via the following command\n\n    ```bash\n    curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python\n    ```\n\n3. Clone this repository to your local, navigate into the folder and run\n\n    ```bash\n    poetry install --no-dev --extras cli\n    ```\n',
    'author': 'M. Eren Akbiyik',
    'author_email': 'erenakbiyik@gmail.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/meakbiyik/soccerbars',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'extras_require': extras_require,
    'entry_points': entry_points,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
