You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
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:
Do exactly as the Cartesian cases do (and then fix the geovector case).
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
Indicates the true vector length (no longer hidden by large head).
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.
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:
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.
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.
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.
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...
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:
Agree that 10% is about right and remove v_stem and use a named constant instead.
Disagree that this was useful and remove v_stem entirely.
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 ?
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.
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%.
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
Adjust the scripts so the arrows show (usually making the arrow heads abit smaller). This still means a PS file update.
Add +nlimit for those cases so that the arrows plot but sizes will vary. Also means update PS file.
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.
Activity
PaulWessel commentedon Dec 27, 2021
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:
maxrjones commentedon Dec 27, 2021
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.
joa-quim commentedon Dec 27, 2021
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.
PaulWessel commentedon Dec 27, 2021
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.
PaulWessel commentedon Dec 27, 2021
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...
maxrjones commentedon Dec 27, 2021
OK, declaring a bug is also fine with me.
joa-quim commentedon Dec 27, 2021
Yes.
PaulWessel commentedon Dec 27, 2021
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:
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 ?
maxrjones commentedon Dec 27, 2021
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.
joa-quim commentedon Dec 27, 2021
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.
PaulWessel commentedon Dec 27, 2021
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%.
PaulWessel commentedon Dec 27, 2021
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
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.
Address a series of issues related to vectors
Address a series of issues related to vectors (#6161)