holoviz / geoviews

Simple, concise geographical visualization in Python
http://geoviews.org
BSD 3-Clause "New" or "Revised" License
577 stars 75 forks source link

Adding a colorbar with matplotlib backend moves the x/y axes into the center of the plot #537

Open stefmolin opened 2 years ago

stefmolin commented 2 years ago

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)

Description of expected behavior and the observed behavior

Adding the colorbar should not affect the x/y axes of the plot (world map), but it is moving both to the center for some reason.

Complete, minimal, self-contained example code that reproduces the issue

import geoviews as gv
import geoviews.feature as gf
gv.extension('matplotlib')

(gf.land * gf.coastline * gf.borders * gv.Points(
    [{'latitude': 0, 'longitude': 0, 'mag': 7},
     {'latitude': 10, 'longitude': 10, 'mag': 2},
     {'latitude': -10, 'longitude': -10, 'mag': 0}], kdims=['longitude', 'latitude'], vdims='mag'
).opts(color='mag', cmap='fire', colorbar=True)).opts(global_extent=True)

Screenshots or screencasts of the bug in action

image

jbednar commented 2 years ago

Yikes! I can reproduce that with geoviews=1.9.2. holoviews=1.14.6, and matplotlib=3.4.3. Hard to see how that could be HoloViews rather than Matplotlib itself, but I'm not sure how to reproduce that with pure Matplotlib.