Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr committed Apr 1, 2024
1 parent 76b5672 commit 6bfcc68
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
24 changes: 15 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ sky.sankey(data,sort=“none”)
```
![Image with options](fruits_sort_none.png)

## Vertical Alignment

The vertical alignment of the diagram can be `”top”`, `”bottom”`, or `”center”`:
```
sky.sankey(data,valign = “center”)
```
![Image with options](fruits_valign.png)

## Labels

Expand Down Expand Up @@ -151,23 +158,27 @@ Allowable values for `<loc_l>` and `<loc_r>` are `"left"`, `"right"`, `"center"

label_loc = [ "left", "none", "right" ]


When adjusting the position of the labels, some care
can be needed to avoid clashing with the printing
of the values. In these examples we just turn the values off.
```
sky.sankey(
data3,
label_loc=["right","right","left"],
value_loc=["none","none","none"],
)
```
![Image with options](frame3_labels.png)

Repeating the labels can he redundant in cases where labels
Repeating the labels can be redundant in cases where labels
are repeated/duplicated in successive stages. Label
duplication can be turned off, which only prints a label
if it didn't appear in the previous stage.
```
sky.sankey(
data3,
label_loc=["right","right","left"],
value_loc=["none","none","none"],
label_duplicate=False,
)
```
Expand Down Expand Up @@ -216,7 +227,7 @@ sky.sankey(data,
![Image with options](fruits_fonts.png)

These options do not use `snake_case` for consistency with their underlying Matplotlib options.
Further font options can be passed through directly via the `label_font` and `title_font` options, which override the settings above.
Further font options can be passed through directly via the `label_font`, `title_font`, and `value_font` options, which override the settings above.

For example:
```
Expand All @@ -229,20 +240,15 @@ sky.sankey(
“fontweight”: “bold”,
},
label_font = {“color”: “blue”},
value_font = {“color”: “green”},
)
```
![Image with options](data3_fonts_fancy.png)

Refer to [Matplotlib documentation](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.text.html) for available options.


## Vertical Alignment

The vertical alignment of the diagram can be `"top"`, `"bottom"`, or `"center"`:
```
sky.sankey(data,valign = "center")
```
![Image with options](fruits_valign.png)


## Frames
Expand Down
17 changes: 9 additions & 8 deletions docs/sankey_doc_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@

import ausankey as sky

data = pd.read_csv("../tests/fruit.csv")

plt.figure()
sky.sankey(data)
plt.show()
plt.savefig("fruits_default.png")
plt.close()

data = pd.DataFrame(
[
("apple", 100, "apple", 50),
Expand All @@ -33,6 +25,12 @@
]
)

plt.figure()
sky.sankey(data)
plt.show()
plt.savefig("fruits_default.png")
plt.close()

plt.figure()
sky.sankey(data, colormap="jet")
plt.show()
Expand Down Expand Up @@ -127,6 +125,7 @@
"fontweight": "bold",
},
label_font = {"color": "blue"},
value_font = {"color": "green"},
)
plt.show()
plt.savefig("data3_fonts_fancy.png")
Expand Down Expand Up @@ -215,6 +214,7 @@
sky.sankey(
data3,
label_loc=["right","right","left"],
value_loc=["none","none","none"],
)
plt.savefig("frame3_labels.png")
plt.close()
Expand All @@ -223,6 +223,7 @@
sky.sankey(
data3,
label_loc=["right","right","left"],
value_loc=["none","none","none"],
label_duplicate=False,
)
plt.savefig("frame3_labels_dup.png")
Expand Down

0 comments on commit 6bfcc68

Please sign in to comment.