JetBrains / lets-plot

Multiplatform plotting library based on the Grammar of Graphics
https://lets-plot.org
MIT License
1.55k stars 49 forks source link

sampling_vertex_vw doesn't work as expected #1175

Closed IKupriyanov-HORIS closed 2 weeks ago

IKupriyanov-HORIS commented 2 weeks ago

The quality of the resulting geometries is unacceptably bad:

from lets_plot import *
LetsPlot.setup_html()

def f(x, y, n):
    z = np.sin(x * 3 * np.pi / n)
    z += np.sin(y * 3 * np.pi / n)
    z += x * 3 / n
    z += y * 5 / n
    return z

n = 50
x = np.arange(n)
y = np.arange(n)
X, Y = np.meshgrid(x, y)
Z = f(X, Y, n)
data = dict(
    x=X.reshape(-1),
    y=Y.reshape(-1),
    z=Z.reshape(-1))

p = ggplot(data, aes('x','y', z='z')) \
    + theme_void() + ggsize(200, 200)
p + geom_contour(sampling=sampling_vertex_vw(100))

image

IKupriyanov-HORIS commented 2 weeks ago

Fixed via https://github.com/JetBrains/lets-plot/commit/80fcbf2b71b68311d89d5034c36849babb0c6086

image