Skip to content

Commit

Permalink
fix: ensure xticks are within plot limits (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoralez authored Sep 23, 2024
1 parent 6d06cb1 commit 73be061
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
Binary file modified nbs/imgs/index.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 nbs/imgs/plotting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 1 addition & 8 deletions nbs/plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,7 @@
" ax[row, col].set_ylabel(ylabel)\n",
" if row == n_rows - 1:\n",
" ax[row, col].set_xlabel(xlabel)\n",
" xticklabels = ax[row, col].get_xticklabels()\n",
" xticks = ax[row, col].get_xticks()\n",
" ax[row, col].set_xticks(\n",
" rotation=30, \n",
" ticks=xticks, \n",
" labels=xticklabels,\n",
" ha=\"right\",\n",
" )\n",
" ax[row, col].tick_params(axis='x', labelrotation=30)\n",
" else:\n",
" fig.update_annotations(selector={\"text\": str(i)}, text=title)\n",
"\n",
Expand Down
9 changes: 1 addition & 8 deletions utilsforecast/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,7 @@ def _add_plotly_plot(fig, df, y_col, levels):
ax[row, col].set_ylabel(ylabel)
if row == n_rows - 1:
ax[row, col].set_xlabel(xlabel)
xticklabels = ax[row, col].get_xticklabels()
xticks = ax[row, col].get_xticks()
ax[row, col].set_xticks(
rotation=30,
ticks=xticks,
labels=xticklabels,
ha="right",
)
ax[row, col].tick_params(axis="x", labelrotation=30)
else:
fig.update_annotations(selector={"text": str(i)}, text=title)

Expand Down

0 comments on commit 73be061

Please sign in to comment.