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

Default tooltips not working for geom_polygon() on small plots #298

Closed
ASmirnov-HORIS opened this issue Jan 27, 2021 · 1 comment
Closed

Comments

@ASmirnov-HORIS
Copy link
Collaborator

There are default tooltips that pop up when I use aesthetics. These tooltips do not pop up when geometry is geom_polygon() and my plot is small enough. See the example below:

import numpy as np
import geopandas as gpd
from shapely.geometry import Polygon

from lets_plot import *
LetsPlot.setup_html()

n = 50
r = 1.0
s = .05
phi = np.linspace(0, 2 * np.pi, n + 1)[:-1]
X = r * np.cos(phi)
Y = r * np.sin(phi)
xy = list(zip(X, Y))
geometry = [Polygon([(x - s / 2, y - s / 2), \
                     (x - s / 2, y + s / 2), \
                     (x + s / 2, y + s / 2), \
                     (x + s / 2, y - s / 2)]) \
            for x, y in xy]
gdf = gpd.GeoDataFrame(dict(x=X, y=Y, phi=phi), geometry=geometry)

p1 = ggplot(gdf, aes(x='x', y='y')) + \
    geom_point(aes(color='phi')) + \
    scale_color_gradient(low='red', high='blue') + \
    coord_fixed() + ggtitle('Geometry: geom_point()')
p2 = ggplot() + \
    geom_polygon(aes(fill='phi'), data=gdf) + \
    scale_fill_gradient(low='red', high='blue') + \
    coord_fixed() + ggtitle('Geometry: geom_polygon()')

bunch = GGBunch()
bunch.add_plot(p1, 0, 0, 400, 400)
bunch.add_plot(p1, 400, 50, 300, 300)
bunch.add_plot(p2, 0, 400, 400, 400)
bunch.add_plot(p2, 400, 450, 300, 300)
bunch.show()

broken tooltips

@OLarionova-HORIS
Copy link
Contributor

There was a restriction on small polygons: area was compared with the constant.
Commit: bd565a2

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

2 participants