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
examples: interactive earthquakes #8138
examples: interactive earthquakes #8138
Conversation
Sorry, I intended to make it draft PR, but did not do that in the end. Should close this one and open a new one? |
Related: #3396
If using See also observablehq variant (edit cell to see the VL) https://observablehq.com/@domoritz/earthquakes-in-vega-lite And altair created-variant: https://deploy-preview-1--spontaneous-sorbet-49ed10.netlify.app/user_guide/marks/geoshape.html#expression |
I converted it to a draft. |
d5bb38d
to
d93d48b
Compare
b6899b8
to
460dda8
Compare
I spent some time trying to make the scale similar to the original vega plot. The results are in the current version of the branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great otherwise.
Thanks, @domoritz. if i want to contribute more, should I go for more examples or start looking at the issues? |
I think looking at issues would be great. Feel free to ask questions on the issues or on slack. |
🚀 PR was released in |
side-note: I was wondering how you'd done the Observe the west coast of north america in this animated gif:
Still a nice example though! |
@mattijn I was playing around with it but I guess I did not get into this edge case. I should probably give it a little bit more though. EDIT: |
So I tried fixing this issue by trying to calculate the angle from which the "observer" looks at the map. Longitude and latitude are just angles projected to 2d panes. If we were able to determine a single 3D angle from the (0,0) axis, knowing from what angle the observer looks at the earth (thanks to rotation values), we could filter which data points should be visible. The problem with this approach is that when I try to work it out using trigonometry, I end up with a quadratic equation, basically allowing for 2 angles to be a solution (one per "visible" and "hidden" half of the sphere), making my solution worthless. Not sure if my calculations are relevant here, if someone needs them I can try to prepare some notes. If someone has an idea of how to approach this problem, I would love to pursue this further. |
I am not convinced that attempting to filter points based on manual calculation of the projection view is the way to go. As well as the edge cases highlighted above, it makes it rather fragile being dependent on the particular projection used. The more robust general solution is to rely on normal projection clipping where we can (as the original Vega example did). It should be noted that pointRadius has been available since VL5 so there are possibilities there. Here, is a simple example that allows two-axis rotation and global setting of symbol size. It uses the original geoJSON representation of earthquake sites rather than extracting the long/lat point coordinates. The problem is that unlike Vega, it is not possible to include data-driven parameterisation in expressions, so using this approach doesn't additionally scale symbols by magnitude. However, you can encode the magnitude data with other aspects of the point symbolisation including colour. While size encoding doesn't work, strokeWidth does, so it is possible to set a data driven point size while representing earthquake sites as geoJSON. Here is an example. It is not perfect because as stroke width is reduced, symbol size tends towards a constant, but perhaps worth considering as an alternative. And as a cartographic aside, I am personally not convinced of the effectiveness of an orthographic projection for these kinds of data. Why not show the whole globe at once, for example with an equalEarth projection: |
Thanks @jwoLondon! I guess i got fixated on filtering. Ill get back to projection. |
Please:
Fixes #1
/Fixes part of #1
).yarn test
).GH_PAT
secret for a personal access token with public repository permissions.site/docs/
+ add examples.Tips:
Related to #1486.
Reimplementing the earthquakes example in
vega-lite
.I did not find it in existing examples.
I would like to ask for some feedback, as I have a problem with scaling the
earthquakeSize
, I am unable to find an option that would allow me to control thepointRadius
from the projection using themagnitude
obtained from datapoints properties. I have been playing around with standardcircle
mark but in that case it seems that points have priority over earth projection making the image unclear.I would love some feedback how to progress with this one, as I could not find
vega-lite
example touching similar problem.