Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4ed6c47
new directory
Jul 4, 2019
f018c2c
finished mapping function
Jul 4, 2019
6fcb83c
Update vfh_charts.py
rickl4 Jul 4, 2019
5b6c816
option for island
Jul 4, 2019
c494f24
merge
Jul 4, 2019
cd37ba8
add optional arguments
Jul 4, 2019
a47909d
add init and setup
Jul 4, 2019
8448dd9
started readme
Jul 4, 2019
901293d
Update README.md
rickl4 Jul 4, 2019
1ccbbf5
line chart functionality #6
Jul 5, 2019
b755406
merge
Jul 5, 2019
0f995d8
markdown edits
Jul 5, 2019
5d13832
added info to markdown for linecharts
Jul 5, 2019
b1ba49f
changed variable definition
Jul 5, 2019
cae6787
renamed module
Jul 8, 2019
5ee93b3
add automatic y axis
Jul 8, 2019
c554170
updated readnme
Jul 8, 2019
dbccdad
added stacked bar
Jul 10, 2019
19e0686
finished all charting functions
Jul 16, 2019
11a8d76
fixed issues with seaborn and fonts
Jul 16, 2019
59f9d33
First draft of the html for the documentation
rickl4 Jul 19, 2019
9da023e
added graph gallery
rickl4 Jul 25, 2019
b9f8cd5
added cells to examples
rickl4 Jul 26, 2019
25da600
Moved stuff to a docs folder
rickl4 Aug 19, 2019
ba9ed1c
moved docs to the root
rickl4 Aug 19, 2019
798ee20
removed html folder
rickl4 Aug 19, 2019
1213921
Removed duplicate files
rickl4 Aug 19, 2019
204397a
Bugfix #13 only create baseline if baseline exists
radumas Oct 24, 2019
22ea477
#13 Upgrade version
radumas Oct 24, 2019
154e341
Fix #16 Change baseline check
radumas Nov 4, 2019
ceae92e
Fix #15 set ylim uses ymax
radumas Nov 4, 2019
e33d835
Ensuring ticks don't go off figure #15
radumas Nov 4, 2019
41fc75a
change psycopg2 package requirement
radumas Aug 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions charts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# README

## Repeatable Information Charts Kit

This module was inspired by charts created for the VFH Bylaw Review Report. There was a need to develop a standardized brand and design language for everything BDITTO produces, so this module aims to produce a regularized set of charts and maps that are consistent with previous charts we create. All of the chart/map producing functions returns a matplotlib `fig` and `ax` object so that the figure can be furthere modified using matplotlib functions.

### `geo.ttc(con)`

Returns a geopandas dataframe of the TTC subway network.

### `geo.island(con)`

Returns a geopandas dataframe of the Toronto Island.

### `charts.chloro_map(con, df, lower, upper, title, **kwargs)`

This function creates a chloropleth map.

The following arguments must be passed in order for the function to run.

|argument|variable type|description|
|-----|-----|-----|
con|SQL Connection Object|Used to additional layers from the SQL database.
df|GeoPandas DataFrame|Data for the chloropleth map. The data must only contain 2 columns; the first column has to be the `geom` column and the second has to be the data that needs to be mapped.
lower|int|Lower bound for the colourmap
upper|int|Upper bound for the colourmap
title|str|Text string for the title text

Additionally, there are optional arguments that can be passed to the function

|argument|variable type|default|description|
|-----|-----|-----|-----|
subway|boolean|`False`|Flag to plot the subway network on the map. False indicates the subway network does not show up.
island|boolean|`True`|Flag to plot the Toronto Islands as having no data. True indicates the islands are coloured the same as the Waterfront neighbourhood.
cmap|str|`YlOrRd`|String to specify colourmap for the map.
unit|str|`None`|Specifies if a unit should be added to the legend box. The automatic placement of the unit only works if the upper or lower are whole numbers.
nbins|int|`2`|Number of ticks in the colourmap

### `charts.line_chart(data, ylab, xlab, **kwargs)`

Produces a simple line chart. The xaxis is not formatted by this function and requires further manipulation with matplotlib. In addition, annotation boxes must be added on manually with a something like this:

```python
fig.text(0.94, 0.96, '176,000', transform=ax.transAxes, wrap = True, fontsize=9, fontname = 'Libre Franklin',
verticalalignment='top', ha = 'center', bbox=props, color = purple)
```

The function defines the styling with the `props` variable, so the only manipulations needed is the positioning and the text itself.

The following arguments must be passed in order for the function to run.

|argument|variable type|description|
|-----|-----|-----|
data|Series or list|Data for the chart
ylab|str|Label for the yaxis
xlab|str|Label for the xaxis

Additionally, there are optional arguments that can be passed to the function

|argument|variable type|default|description|
|-----|-----|-----|-----|
ymin|int|0|Lower bound for the yaxis
ymax|int|The maximum value of the dataset|Upper bound for the yaxis
yinc|int|One-third of the range of the data|Interval for the yaxis ticks

### `charts.tow_chart(data, ylab, **kwargs)`

Produces a 7-Day time of week chart that shows data points for each hour during one week. The xaxis is fixed to the 168 hours that produces the week, and the data must be ordered so that the first entry represents Monday at midnight.

The following arguments must be passed in order for the function to run.

|argument|variable type|description|
|-----|-----|-----|
data|Series or list|Data for the chart
ylab|str|Label for the yaxis

Additionally, there are optional arguments that can be passed to the function

|argument|variable type|default|description|
|-----|-----|-----|-----|
ymin|int|0|Lower bound for the yaxis
ymax|int|The maximum value of the dataset|Upper bound for the yaxis
yinc|int|One-third of the range of the data|Interval for the yaxis ticks
1 change: 1 addition & 0 deletions charts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from rick import *
532 changes: 532 additions & 0 deletions charts/module_test.ipynb

Large diffs are not rendered by default.

Loading