Skip to content

Vectors with heads exceeding vector length #6158

Closed

Description

@PaulWessel

We have a +n modifier to deal with short vectors and can shrink the head and vector attributes. However, if +n is not used and the (fixed) head size exceeds the vector length, what should happen? Here is an example that compares what happens for geographic and Cartesian vectors (plain and regular):

full_heads

There is consistency between Cartesian and plain geovector, but the filled-head geovector just vanishes when we hit the critical length = head-length. I think we want consistent behavior, and here are two possibilities:

  1. Do exactly as the Cartesian cases do (and then fix the geovector case).
  2. Refuse to draw any head if head > length (and fix the 3 other cases).

The second solution would at least draw a short line that

  1. Indicates the true vector length (no longer hidden by large head).
  2. Indicates the azimuth (which is clearer with the large head).

I suspect there is no obvious answer here so perhaps this warrants a modifier, e.g., +n with no args means stop drawing head if it is longer than the vector length [Default does as in the top 3 plots]. I guess I do not like the current default since the magnitude of the vector is basically lost behind the vector head, but rather than breaking backwards compatibility I would be OK with the argument-less +n solution.

Comments, @GenericMappingTools/core ?

Activity

  1. added
    bug
    on Dec 27, 2021
  2. added this to the milestone on Dec 27, 2021
  3. self-assigned this
    on Dec 27, 2021
  4. PaulWessel commented on Dec 27, 2021

    @PaulWessel
    ContributorAuthor

    I should add that this is what happens when the vector head is at the end. if we use +b it is the same (vector tip at the start of the vector with the tail sticking up beyond the end of the vector. And if we do +b and +e then they overprint:

    full_heads_be

  5. maxrjones commented on Dec 27, 2021

    @maxrjones
    Member

    The +n solution seems fine to me. I doubt users frequently re-read the contents of the vector attributes section so it might be worthwhile to place a warning for cases such as the short vectors with +b and +e.

  6. joa-quim commented on Dec 27, 2021

    @joa-quim
    Member

    I'm in favor of just not drawing the head without the need of +n. If user reads docs to know about +n so he will know about its modifiers too. Fixing this can't be seen as a compatibility break.

  7. PaulWessel commented on Dec 27, 2021

    @PaulWessel
    ContributorAuthor

    OK, so you are OK with declaring the first three plots as bugs and just fixing it to skip too-large heads? This was my sense too as the user cannot possibly benefit from having the head block the data.

  8. PaulWessel commented on Dec 27, 2021

    @PaulWessel
    ContributorAuthor

    We certainly used to have warnings when heads were too large for the vector; will have to look. I think issuing a warning that heads are skipped and let user consider using +n is a good option. I to tend to see this as a bug and the most recently implemented arrows (geovector) certainly skips when things are too small (or seems to - need to follow up on that u,v meteorology plot which had some odd short vectors at the wrong end...

  9. maxrjones commented on Dec 27, 2021

    @maxrjones
    Member

    OK, declaring a bug is also fine with me.

  10. joa-quim commented on Dec 27, 2021

    @joa-quim
    Member

    OK, so you are OK with declaring the first three plots as bugs and just fixing it to skip too-large heads?

    Yes.

  11. PaulWessel commented on Dec 27, 2021

    @PaulWessel
    ContributorAuthor

    Working on this and fixing issues. One thing I noticed is that we have a variable called vector attribute v_stem set to 0.1 (10%) and the header says

    gmt_plot.h: float v_stem; /* Min length in % of visible vector when head is large [10%] */

    This is not (yet) possible to change by the user. What it means is that the vector length needs to be 10% longer than the vector head for us to draw the vector head, so that 10% of the "stem" will stick out behind the head. I think I just added this as it seemed dumb (to me) to just have a vector head and no stem at all (which is the limiting case if v_stem is 0). Interestingly, this feature was only applied to geovectors and not Cartesian vectors. So, options:

    1. Agree that 10% is about right and remove v_stem and use a named constant instead.
    2. Disagree that this was useful and remove v_stem entirely.
    3. Decide it needs to user accessible by yet another modifier +ffact [0.1].

    Options 1 and 3 means we also do it for the Cartesian vector. Note: The GMT 4 vector is unaffected by any of this since it is just a legacy implementation.

    I don't like 3 since there is already too many modifiers, but if you see value then I don't mind adding that. Option 1 which I implemented is a bit subjective, so I will be fine with taking option 2, but my default position is 1. What you think, @meghanrjones and @joa-quim ?

  12. maxrjones commented on Dec 27, 2021

    @maxrjones
    Member

    Using option 1 is in line with the previous decision to declare the geo case correct and Cartesian cases bugs; that case works for me.

  13. joa-quim commented on Dec 27, 2021

    @joa-quim
    Member

    Option 2. Why complication with a tinny tail? And besides, when arrow heads are not triangles we'll still see more than 10% of the stem inside the head.

  14. PaulWessel commented on Dec 27, 2021

    @PaulWessel
    ContributorAuthor

    Meanwhile I learned a few other things related to how -W can be used to add a vector at the ends of lines (here the "length" passed to psl_vector is not relevant) I need in fact to implement option 2 after all for simplicity. So no more Mr. 10%.

  15. PaulWessel commented on Dec 27, 2021

    @PaulWessel
    ContributorAuthor

    Given the changes, about 10 tests need new PS originals. A few of the failures are silly and has to do with arrows I have placed on some plot to highlight a thing or indicate handedness of a polygon. For some cases, some of these arrows are now "too short" to be plotted. Yet, in my mind they are kind of arrows on a line (like psxy -W) but I cannot do anything about them since I am just plotting a fixed vector given data from the grid (so I cannot easily fudge a longer line). My options are

    1. Adjust the scripts so the arrows show (usually making the arrow heads abit smaller). This still means a PS file update.
    2. Add +nlimit for those cases so that the arrows plot but sizes will vary. Also means update PS file.
    3. Add flag that says do plot head regardless so it can be used in these cases. E.g., the +n with no arg would mean "no shrink and no skip". This means PS original is still good.

    Given the failures I see it would be handy to turn off the skipping of heads for those rare cases that it is needed. I already have added an internal flag for this since it was needed to solve the trimmed line as well as GRAPH basemap axes; all that is needed is to connect +n with that parameter.

    I think this is the best option to avoid breaking even other peoples script without there being a solution, and also minimizes the need for PS orig updates here.

  16. added a commit that references this issue on Dec 28, 2021
    6b2b5d2
  17. added a commit that references this issue on Dec 28, 2021
    c923ecc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions