Skip to content

Commit

Permalink
Merge pull request #45 from uit-cosmo/v0.5
Browse files Browse the repository at this point in the history
V0.5
  • Loading branch information
audunth authored Dec 17, 2024
2 parents a5d7e95 + f8556ad commit fca19cf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pip install cosmoplots
```

If you want the development version you must first clone the repo to your local machine,
then install the project and its dependencies with [poetry]:
then install the project and its dependencies with [poetry](https://python-poetry.org):

```sh
git clone https://github.com/uit-cosmo/cosmoplots.git
Expand Down Expand Up @@ -63,11 +63,19 @@ for i in range(rows*columns):
ax[i].set_xlabel("X Axis")
ax[i].set_ylabel("Y Axis")
ax[i].plot(i*a)
# plt.savefig("assets/multifig.png")
plt.show()
```

![multifig](./assets/multifig.png)

#### Position of the y-axis

By default, the x-coordinates of the y-axis labels are aligned with the subfigure labels, but the y-axis label position can be adjusted using
```python
ax[i].yaxis.set_label_coords(x_coordinate, y_coordinate)
```

## `change_log_axis_base`

```python
Expand Down Expand Up @@ -137,9 +145,6 @@ with plt.style.context("cosmoplots.default"):
| :--------: | :--------: |
| ![matplotlib](./assets/matplotlib.png) | ![cosmoplots](./assets/cosmoplots.png) |

<!-- Links -->
[poetry]: https://python-poetry.org

## `generate_hex_colors`

This function generates the hex numbers for the colours extracted from a `matplotlib` colour map based on the number of points of interest.
Expand All @@ -152,7 +157,7 @@ plt.style.use(["cosmoplots.default"])


color_list = cosmoplots.generate_hex_colors(5, 'viridis', show_swatch=True, ascending=True)
plt.savefig("./assets/hex_colors.png")
# plt.savefig("./assets/hex_colors.png")

# Print color_list to retrieve the hex numbers
print(color_list) #['#fde725', '#5ec962', '#21918c', '#3b528b', '#440154']
Expand All @@ -162,7 +167,7 @@ ax = plt.gca()
for i, color in enumerate(color_list):
ax.plot([1,2],[i,i+1], c = color)

plt.savefig("./assets/hex_colors_example.png")
# plt.savefig("./assets/hex_colors_example.png")
plt.show()
```

Expand Down
Binary file modified assets/concat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/multifig.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cosmoplots"
version = "0.4.3"
version = "0.5.0"
description = "Routines to get a sane default configuration for production quality plots."
homepage = "https://github.com/uit-cosmo/cosmoplots"
authors = ["gregordecristoforo <gregor.decristoforo@gmail.com>"]
Expand Down

0 comments on commit fca19cf

Please sign in to comment.