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

Geom.density2d with Scale transformation #1431

Closed
Mattriks opened this issue Apr 30, 2020 · 0 comments · Fixed by #1432
Closed

Geom.density2d with Scale transformation #1431

Mattriks opened this issue Apr 30, 2020 · 0 comments · Fixed by #1432

Comments

@Mattriks
Copy link
Member

Example from julia discourse

x = [0.025, 0.028, 0.035, 0.036, 0.037, 0.039, 0.039, 0.041, 0.041, 0.041, 0.042, 0.043, 0.045, 0.047, 0.049, 0.051, 0.053, 0.053, 0.055, 0.056, 0.057, 0.057, 0.059, 0.063, 0.063, 0.067, 0.067, 0.069, 0.07, 0.072, 0.073, 0.075, 0.076, 0.076, 0.078, 0.082, 0.083, 0.083, 0.084, 0.085, 0.085, 0.086, 0.09, 0.092, 0.092, 0.093, 0.095, 0.095, 0.096, 0.103, 0.103,
0.104, 0.104, 0.105, 0.105, 0.106, 0.107, 0.107, 0.108, 0.109, 0.11, 0.117, 0.119, 0.119, 0.12, 0.126, 0.133, 0.133, 0.135, 0.135, 0.135, 0.137, 0.138, 0.141, 0.144, 0.144, 0.145, 0.145, 0.146, 0.146, 0.149, 0.151, 0.155, 0.155, 0.159, 0.162, 0.162, 0.163, 0.164, 0.167, 0.17, 0.171, 0.172, 0.179, 0.181, 0.187, 0.187, 0.188, 0.188, 0.201, 0.204, 0.204, 0.205, 0.208, 0.208, 0.213, 0.214, 0.214, 0.218, 0.221, 0.222, 0.23, 0.231, 0.238, 0.239, 0.245, 0.245, 0.25, 0.256, 0.256, 0.258, 0.262, 0.262, 0.263, 0.264, 0.267, 0.269, 0.273, 0.273, 0.276, 0.279, 0.288, 0.292, 0.296, 0.296, 0.297, 0.298, 0.301, 0.322, 0.324, 0.328, 0.332, 0.336, 0.341, 0.347, 0.354, 0.357, 0.365, 0.376]
y = [0.018, 4.0, 0.288, 0.157, 0.037, 0.163, 0.06499999, 1.0, 0.09199999, 0.203, 0.26, 0.028, 0.243, 4.0, 2.0, 0.852, 58.0, 4.0, 0.023, 2.48, 4.0, 3.0, 14.0, 37.3, 0.121, 2.0, 12.0,
4.0, 19.0, 4.0, 0.038, 1.0, 2.0, 0.146, 0.061, 0.127, 2.0, 203.0, 2.0, 2.0, 0.278, 2.0, 0.229, 2.0, 0.3, 4.0, 4.0, 0.146, 289.0001, 4.0, 2.0, 2.0, 0.163, 1.0, 0.266, 4.0, 3.0, 1.0, 9.0, 3.0, 0.171, 1.0, 0.264, 10.0, 0.374, 1.0, 2.0, 2.0, 25.0, 2.0, 0.582, 2.0, 15.0, 2.0, 2.0, 3.0, 2.0, 2.0, 2.0, 1.93, 9.0, 2.0, 19.0, 0.684, 4.0, 2.0, 2.0, 2.0, 19.0, 2.0, 6.0, 2.0, 5.0, 2.0, 4.0, 1351.0, 3.0, 2.0, 4.0, 4.0, 12.0, 9.0, 6.0, 6.0, 6.0, 1291.0, 5.0, 79.00001, 28.0, 7.0, 5.0, 60.0, 16.0, 15.0, 14.0, 49.0, 9.0, 19.0, 26.0, 35.0, 79.00001, 26.0, 4.0, 192.0, 79.00001, 26.0, 35.0, 148.0, 31.0, 46.99999, 79.00001, 456.0, 88.0, 21.0, 149.0, 31.0, 465.0001, 19.0, 81.00001, 48.0, 139.0, 938.9999, 303.0, 214.0, 440.9999, 168.0, 367.0, 196.0, 437.9999]

plot(x=x, y=y, Geom.point, Geom.density2d, Scale.y_log10)

DomainError with -0.014589995486293805: NaN result for non-NaN input.

The issue here actually lies wtih Stat.contour. In Gadfly, the Stats are applied after the scales are transformed, but in these lines, the user supplied Scales are applied a second time. Only a regular scale needs to be applied the second time. I'll open a PR sometime soon.

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

Successfully merging a pull request may close this issue.

1 participant