Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/UBC-MDS/hueniversitypy
https://github.com/UBC-MDS/hueniversitypy
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/UBC-MDS/hueniversitypy
- Owner: UBC-MDS
- License: mit
- Created: 2020-02-25T21:09:56.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-26T18:34:14.000Z (almost 5 years ago)
- Last Synced: 2024-08-04T01:13:25.706Z (5 months ago)
- Language: Python
- Size: 658 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-vega - hueniversitypy - Canadian university themes. (Altair / Packages)
README
## hueniversitypy
![](https://github.com/UBC-MDS/hueniversitypy/workflows/build/badge.svg) [![codecov](https://codecov.io/gh/UBC-MDS/hueniversitypy/branch/master/graph/badge.svg)](https://codecov.io/gh/UBC-MDS/hueniversitypy) ![Release](https://github.com/UBC-MDS/hueniversitypy/workflows/Release/badge.svg)
[![Documentation Status](https://readthedocs.org/projects/hueniversitypy/badge/?version=latest)](https://hueniversitypy.readthedocs.io/en/latest/?badge=latest)
Python package for creating visualizations in line with visual identities of Canadian universities
### Summary
A visual identity allows an organization to be instantly recognizable. Comprised of their logo, typeface, and colours, it is applied when creating external and internal communications. At universities, staff create visualizations that adhere to the colour palette specified by their institution's visual identity guidelines. For example, on the [*Students and Alumni*](https://masterdatascience.ubc.ca/why-ubc/students-alumni) page of UBC Master of Data Science website, the visualizations all adhere to the colour palette specified by UBC's visual identity guideline.
This Python package allows users to apply university-specific themes to altair plots. This package currently supports the official colour palettes of four institutions belonging to the U15 Group of Canadian Research Universities: University of Alberta, the University of British Columbia, McGill University, and the University of Toronto. In the future, we hope to extend this package to support the visual identities of all universities in the association.
### hueniversitypy in the Python ecosystem
The hueniversitypy package fits into the Python ecosystem alongside other Python packages that allow users to change the theme of plot objects. This package is different from others as it utilizes the altair visualization package rather than other types of visualization packages. Currently, there are very few packages in the Python ecosystem that apply themes to altair plots, as described in this [GitHub issue]( https://github.com/altair-viz/altair/issues/1333). One package that is designed to change the theme of altair plots for the Los Angeles Times publications can be found [here](https://github.com/datadesk/altair-latimes). Our package will be different as the goal of the change in plot theme is to adhere to certain university visual identities, rather than the Los Angeles Times colour theme.
### Installation:
```
pip install -i https://test.pypi.org/simple/ hueniversitypy
```### Features
- `theme_alberta()` - creates visualizations in line with [the University of Alberta's visual identity](https://www.ualberta.ca/toolkit/visual-identity/our-colours)
- `theme_mcgill()` - creates visualizations in line with [McGill University's visual identity](https://mcgill.ca/visual-identity/visual-identity-guide#mcgilllogo)
- `theme_toronto()` - creates visualizations in line with [the University of Toronto's visual identity](https://www.utm.utoronto.ca/communications/sites/files/communications/public/shared/UofT%20Style%20Guide%20%2B%20Boundless%20Guide%20Feb%202012.pdf)
- `theme_ubc()` - creates visualizations in line with [the University of British Columbia's visual identity](https://brand.ubc.ca/guidelines/downloads/ubc-colour-and-fonts/)### Dependencies
Python 3.7 and the following Python packages:
| Package | Minimum Version |
|---------|-----------------|
| [pandas](https://pandas.pydata.org/) | 1.0.1 |
| [altair](https://github.com/altair-viz/altair) | 4.0.1 |### Documentation
The official documentation is hosted on [Read the Docs](https://readthedocs.org/): https://hueniversitypy.readthedocs.io/en/latest/?badge=latest
### Citation
Reiko Okamoto, Shivam Verma, Simardeep Kaur & Evelyn Moorhouse. hueniversitypy, (2020), GitHub repository, https://github.com/UBC-MDS/hueniversitypy
Bibtex:
```
@misc{
authors = {Reiko Okamoto, Shivam Verma, Simardeep Kaur, Evelyn Moorhouse},
title = {hueniversitypy},
year = {2020},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/UBC-MDS/hueniversitypy}},
}
```### Usage
Start by importing the following packages:
```
from hueniversitypy.theme_alberta import *
from hueniversitypy.theme_mcgill import *
from hueniversitypy.theme_toronto import *
from hueniversitypy.theme_ubc import *
import altair as alt
import pandas as pd
from vega_datasets import data
```
```
# Modified sample code from Altair docscars = data.cars()
scatterplot = (alt
.Chart(cars)
.mark_circle(size=60, opacity=0.5)
.encode(x='Horsepower',
y='Miles_per_Gallon',
color='Origin'
)
).properties(width=400, height=400)barley = data.barley()
barplot = (alt
.Chart(barley)
.mark_bar()
.encode(
x='year:O',
y='sum(yield):Q',
color='year:N',
column='site:N'
)
)
```### `theme_alberta()`
Available palette:
Output:
- No direct output, however for every subsequent altair object in the script or .ipynb file the theme will be in line with [the University of Alberta’s visual identity](https://www.ualberta.ca/toolkit/visual-identity/our-colours)
```
alt.themes.register("theme_alberta", theme_alberta)
alt.themes.enable("theme_alberta")scatterplot
``````
barplot
```### `theme_mcgill()`
Available palette:
Output:
- No direct output, however for every subsequent altair object in the script or .ipynb file the theme will be in line with [McGill University’s visual identity](https://mcgill.ca/visual-identity/visual-identity-guide#mcgilllogo)
```
alt.themes.register("theme_mcgill", theme_mcgill)
alt.themes.enable("theme_mcgill")scatterplot
``````
barplot
```### `theme_toronto()`
Available palette:
Output:
- No direct output, however for every subsequent altair object in the script or .ipynb file the theme will be in line with [the University of Toronto’s visual identity](https://www.utm.utoronto.ca/communications/sites/files/communications/public/shared/UofT%20Style%20Guide%20%2B%20Boundless%20Guide%20Feb%202012.pdf)
```
alt.themes.register("theme_toronto", theme_toronto)
alt.themes.enable("theme_toronto")scatterplot
``````
barplot
```### `theme_ubc()`
Available palette:
Output:
- No direct output, however for every subsequent altair object in the script or .ipynb file the theme will be in line with [the University of British Columbia’s visual identity](https://brand.ubc.ca/guidelines/downloads/ubc-colour-and-fonts/)
```
alt.themes.register("theme_ubc", theme_ubc)
alt.themes.enable("theme_ubc")scatterplot
``````
barplot
```### Credits
This package was created with Cookiecutter and the UBC-MDS/cookiecutter-ubc-mds project template, modified from the [pyOpenSci/cookiecutter-pyopensci](https://github.com/pyOpenSci/cookiecutter-pyopensci) project template and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage).