There are some hacks for doing this: http://stackoverflow.com/questions/8342549/matplotlib-add-colorbar-to-a-sequence-of-line-plots
But it would be nice if this was just a single line of code:
plt.colorbar(cmap=cm.jet,min=0.0,max=1.0)
There are some hacks for doing this: http://stackoverflow.com/questions/8342549/matplotlib-add-colorbar-to-a-sequence-of-line-plots
But it would be nice if this was just a single line of code:
plt.colorbar(cmap=cm.jet,min=0.0,max=1.0)
Comments are closed.
Copyright © 2021 Fantas...hit
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
Having a common colorbar for multiple axes is part of what I was looking for, but what I’d really like is the ability to explicitly set the limits of the colorbar via arguments to the colorbar method.
Example of making a colorbar that is not tied to anything else:
http://matplotlib.org/examples/api/colorbar_only.html
“Mappable” refers to an Artist subclass that inherits from the ScalarMappable mixin:
http://matplotlib.org/api/cm_api.html
Close if you want to — but just to clarify:
The point of the original issue was to request that the interface be simplified. Yes, there are ways to create a colorbar on e.g. line plots:
But this isn’t intuitive/easy for users — you more or less need to go to stackoverflow or dig deep into the documentation/examples to figure this out. So the proposal/feature request was to make this a one-liner and have matplotlib execute something like the above code under the hood (without the user needing to know what a
ScalarMappable
is).Well my use case was an animation where the lines were changing color over time. For example, representing flow in a network, or electricity.
I wanted a colorbar on the side to show the range of the colormap I was using. So, for example, if the maximum flow allowable was
1.0
, it would be nice to just specify:Edit: Also, while the
LineCollection
example is a nice one, it isn’t immediately obvious to the common user that it exists and how to take advantage of it. Whereas I think the above one-liner is likely something people would try off the bat (especially if the min/max options are listed in the documentation forcolorbar
).