Skip to content

Commit

Permalink
feat(matrix-handler): tweak tick size relative to defaults
Browse files Browse the repository at this point in the history
This allows users to modify the tick size by changing the defaults,
which is very useful:

https://matplotlib.org/stable/users/explain/customizing.html
  • Loading branch information
sanjayankur31 committed Nov 7, 2023
1 parent 59309c2 commit 3c67140
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions neuromllite/MatrixHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,33 @@ def finalise_document(self):
ax.set_yticklabels(entries)
ax.set_xticklabels(entries)
ax.set_ylabel("presynaptic")
tick_size = (
10

# change in relation to default so that users can override
default_tick_size_x = matplotlib.rcParams["xtick.labelsize"]
tick_size_x = (
default_tick_size_x
if weight_array.shape[0] < 20
else (8 if weight_array.shape[0] < 40 else 6)
else (
(default_tick_size_x - 2)
if weight_array.shape[0] < 40
else (default_tick_size_x - 4)
)
)
ax.tick_params(axis="y", labelsize=tick_size)
ax.tick_params(axis="x", labelsize=tick_size_x)

default_tick_size_y = matplotlib.rcParams["ytick.labelsize"]
tick_size_y = (
default_tick_size_y
if weight_array.shape[0] < 20
else (
(default_tick_size_y - 2)
if weight_array.shape[0] < 40
else (default_tick_size_y - 4)
)
)
ax.tick_params(axis="y", labelsize=tick_size_y)

ax.set_xlabel("postsynaptic")
ax.tick_params(axis="x", labelsize=tick_size)
fig.autofmt_xdate()

for i in range(len(entries)):
Expand Down

0 comments on commit 3c67140

Please sign in to comment.