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

Arrows using elevation value for any point(x, y) in contour chart #36

Closed
polaris0227 opened this issue Dec 5, 2019 · 5 comments
Closed

Comments

@polaris0227
Copy link

I want to draw arrows using elevation value in contours like below screenshot.

arrows

Please help me on it if anyone can do it.
Thanks so much.

@Fil
Copy link
Member

Fil commented Dec 5, 2019

See https://observablehq.com/@grahampullan/gradient-of-a-scalar-field — and https://observablehq.com/@d3/vector-field for an alternative rendering of the arrows.

@Fil Fil closed this as completed Dec 5, 2019
@polaris0227
Copy link
Author

polaris0227 commented Dec 5, 2019 via email

@polaris0227
Copy link
Author

polaris0227 commented Dec 5, 2019 via email

@Fil
Copy link
Member

Fil commented Dec 5, 2019

It would probably depend on the format of your csv. However once you transform it into a linear array values suitable for d3.contour, you can use

function value(x, y) {
  return values[Math.round(x) + width * Math.round(y)]
}

@Fil
Copy link
Member

Fil commented Dec 5, 2019

Edit: I realize you are probably using density contours, not rectangular contours ; so the answer might be more complicated. Please share a notebook on Observable and we'll see how to help you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants