-
Notifications
You must be signed in to change notification settings - Fork 367
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
Add -l to grdvector for legend entry #6199
Conversation
The magnitude of the legend vector (in data units) can be set via -S modifier +sref.
Hi @PaulWessel, Indeed, but we could still use a reference like 25ºN being defined manually through |
Since the latitude 25N has no bearing on the plotted length of the arrow, you would just use -l"10 m/s". The only arrows that vary with latitude would be geovectors and right now grdvector does not allow -l with those due to their variable length. I mean, you could att "@ 25N" to your label but there is no need to pass +m25 since it has no effect. |
That's my point, you could allow it as long as "@25n" is required (or middle latitude by default) |
Well, it would need to be like in the map scale syntax -L. So perhaps we require +c for geovectors: Use +c[[slon/]slat]] to control where on a geographic map the reference geovector length set via +s applies. Legend vector length is calculated for latitude slat (optionally supply longitude slon for oblique projections [default is central meridian]). If +c is given with no arguments then we select the length to be true at the middle of the map. |
👍 I like that (if not too much work) I would greatly clean some of my codes by getting rid of |
Now, grdvector supports legends for geovector also, by requiring the +c setting. Also note that while the length of the vector is computed as discussed, the vector that is actually plotted in the legend is the Cartesian vector since there is no simple way to plot a slightly curved great circle stem there anyway. |
I think t.txt, t.pdf, x.grd, and y.grd in test/grdvector may have been committed by mistake. We could also remove the two postscript files because I can add them using dvc when updating the other failing tests. |
OK, got rid of those plus gmt.history and a PDF file. yikes... |
I'll update some of my scripts next month to try this |
This PR adds -l to the grdvector repertoire. The magnitude of the legend vector (in data units) can be set via -S modifier +srefval. Note that -l requires Cartesian vectors as geovectors do not have a constant representation on a map w.r.t. a reference length but can vary with position and projection. A simple new test (veclegend.sh) demonstrates the effect:
A few minor issues had to be fixed, such as an update to the plate.ps original, and a special check to honor grdvector settings for shrinking which are assumed to be in data units unless an actual unit is added (outside grdvector we expect to see the unit q for this).
Pinging @gd-a as well for information.