Giter VIP home page Giter VIP logo

matplotlib-colorbar's People

Contributors

cphyc avatar jnth avatar ppinard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jnth cphyc achuda-g

matplotlib-colorbar's Issues

UserWarning: This call to matplotlib.use() has no effect

When importing from matplotlib_colorbar.colorbar import Colorbar after matplotlib has already been imported, say with %matplotlib inline, a warning comes up:

/Users/username/anaconda3/envs/scipy/lib/python3.6/site-packages/ipykernel/__main__.py:8: UserWarning: 
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

I managed to trace the warning, and it's coming from matplotlib_colorbar/colorbar.py, line 83:

imp.reload(sys.modules['matplotlib'])

If this is OK, maybe you can suppress the warning?

import warnings
with warnings.catch_warnings():
    warnings.simplefilter("ignore", UserWarning)
    imp.reload(sys.modules['matplotlib'])

Colorbar size depends on data scale

The scale of the drawn colorbar is not independent of the data scale.

The following code generates the following image

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from matplotlib_colorbar.colorbar import Colorbar
%matplotlib inline
data = np.array(plt.imread(cbook.get_sample_data('grace_hopper.png')))
mappable = plt.imshow(data[...,0],  cmap='viridis')
colorbar = Colorbar(mappable, location='lower left')
plt.gca().add_artist(colorbar)

image

Modifying the data scale (by multiplying by 15) with the following code generates this image

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from matplotlib_colorbar.colorbar import Colorbar
%matplotlib inline
data = np.array(plt.imread(cbook.get_sample_data('grace_hopper.png')))
mappable = plt.imshow(data[...,0]*15,  cmap='viridis')
colorbar = Colorbar(mappable, location='lower left')
plt.gca().add_artist(colorbar)

image

Colorbar is ignoring the norm

It seems that the colorbar is not providing norm to the PatchCollection, resulting in the wrong colors being plotted.

Travis cannot upload to PyPI

The following error occurs when travis tries to upload new release to PyPi:

HTTPError: 401 Client Error: You must be identified to edit package information for url: https://pypi.python.org/pypi

Unable to import Colorbar

Traceback (most recent call last):
  File "plot_this.py", line 6, in <module>
    from matplotlib_colorbar.colorbar import Colorbar
  File "/usr/lib/python3.7/site-packages/matplotlib_colorbar/colorbar.py", line 41, in <module>
    from matplotlib.cbook import is_string_like
ImportError: cannot import name 'is_string_like' from 'matplotlib.cbook' (/usr/lib/python3.7/site-packages/matplotlib/cbook/__init__.py)

System info:

Python 3.7.0 (default, Sep 15 2018, 19:13:07) 
[GCC 8.2.1 20180831] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib as mlab
>>> mlab.__version__
'3.0.0'
>>> import matplotlib_colorbar as mcb
>>> mcb.__version__
'0.3.5'
>>> from matplotlib_colorbar.colorbar import Colorbar
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/matplotlib_colorbar/colorbar.py", line 41, in <module>
    from matplotlib.cbook import is_string_like
ImportError: cannot import name 'is_string_like' from 'matplotlib.cbook' (/usr/lib/python3.7/site-packages/matplotlib/cbook/__init__.py)
>>> 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.