Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: when fontsize is changed colorbar scale may be wrong #297

Closed
lldelisle opened this issue Oct 26, 2020 · 1 comment
Closed

Bug: when fontsize is changed colorbar scale may be wrong #297

lldelisle opened this issue Oct 26, 2020 · 1 comment

Comments

@lldelisle
Copy link
Collaborator

Here is an example of what can happen when we change the fontsize:
Left is without specifying the fontsize, Right is using --fontSize 16
image
You can see that the picture stay the same but the colorbar is wrong.
This is due to:

ticks = cobar.ax.get_yticks()
labels = cobar.ax.set_yticklabels(ticks.astype('float32'))
(vmin, vmax) = cobar.mappable.get_clim()
for idx in np.where(ticks == vmin)[0]:
# if the label is at the start of the colobar
# move it above avoid being cut or overlapping with other track
labels[idx].set_verticalalignment('bottom')
for idx in np.where(ticks == vmax)[0]:
# if the label is at the end of the colobar
# move it a bit inside to avoid overlapping
# with other labels
labels[idx].set_verticalalignment('top')

Because the label are fixed but not the ticks...

@lldelisle
Copy link
Collaborator Author

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant