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

Colorbar #12

Merged
merged 7 commits into from
Mar 25, 2022
Merged

Colorbar #12

merged 7 commits into from
Mar 25, 2022

Conversation

guiwitz
Copy link
Owner

@guiwitz guiwitz commented Mar 25, 2022

This PR adds the possibility to add a colorbar to the plots using the show_colorbar=True option and thus answers the request in issue #12

As all images are scaled between 0-1, indicating the correct pixel values on the scale required to update several coloring functions e.g.

return image_rescaled, min_max
from the colorify module so that the true min/max pixel values used would not be lost during scaling. That information is now kept as an attribute of the Microimage object:
microim.image_min_max = image_min_max

Additional minor fixes:

  • the random gradient colormap is explained, and the num_colors argument actually used.
  • depending on wether a movie is created in a notebook or in a script (e.g. in tests), the canvas size was not recovered correctly (factor x2 in a script). This made the reshaping of the rgb byte string fail. It seems that measuring the canvas dimensions directly from the renderer fixes this problem:
    w,h = map(int, anim_object.fig.canvas.renderer.get_canvas_width_height())

@guiwitz guiwitz merged commit c4c7ad0 into master Mar 25, 2022
@guiwitz guiwitz deleted the colorbar branch March 25, 2022 19:40
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

Successfully merging this pull request may close these issues.

1 participant