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
{{ message }}
Repository navigation
Unclear bar plot (-Sb or -SB) generated by plot when only appending +v (no +s) #7021
Please see the explanation to plot vertical and horizontal bars in the GMT documentation of the plot module, especially the following part (exemplary for horizontal bars):
Here, +i means we must accumulate the bar values from the increments dx, while +v means we get the complete values relative to base. Normally, the bands are plotted as sections of a final single bar. Use +s to instead split the bar into nx side-by-side, individual and thinner bars.
What is the expected bar plot (-Sb or -SB ) for only appending +v (no +s), maybe overlaid bars?
This question arises since the generated figure shown below remains unclear, especially for the lower bar. In the case of overlaid bars, three differently colored sections seem to make sense for the upper bar, since two of the four values for this bar are identical. The lower bar contains only three differently colored sections, despite four different values are given in the provided txt file. The values are not given in an increasing / a decreasing order.
Opening this issue is related to GenericMappingTools/pygmt#1521 (comment).
Before I look at this, isn't it reasonable that the data need to be sorted from low to high in case of +v since it is cumulative x-values? If I fix the order, I get
We can either state this in the docs or (probably better) do a sort when +v is set ,but seems odd to me to give the data not sorted.
I mean, the data and use for this type of symbol might be categorical thinks with different values, and it makes absolutely no sense to me to if the values relative to base are not sorted. What am I misunderstanding here?
There is nothing wrong with sorting the values before plotting them for this type of symbol or bar plot.
My example is slightly modified from a planed PyGMT gallery example by @michaelgrund (bottom right panel, using +v without +s), which seems to be based on an example in the GMT documentation. In the PyGMT example, the data is [currently] not sorted before plotting. No remark is stated, that this is partly necessary when using +v. Thus, as suggested by @PaulWessel, I feel comments in the GMT documentation and the example explanation, that users have to sort the data externally when using +v without +s before passing it to the plot module or method [as long this is not done by plot], would avoid confusion.
For +i it is clearly required that the data are in the right order since sorting makes no sense. For +v I fail to see what sort of actual data would come with values in different columns. Maybe I just dont understand the use. Basically, the data given via +i cumulatively sum to give the required comparable input if +v is used. You cannot shuffle columns around. Your example above, is that really an actual data example of just an made-up example to demonstrate the plotting?
If I'm guessing right +v plots the bars from last to first, so if values are not sorted some bars will be completely hidden by some other(s). So, yes, data must absolutely be sorted.
If I'm guessing right +v plots the bars from last to first, so if values are not sorted some bars will be completely hidden by some other(s).
Meaning for the data example 0.25 1 0.65 0.4 2.25 the value 0.4 should be hidden by the value 0.65, correct? But looking at the figure above, this seems not the case. There are sections for 2.25 (blue), 0.4 (yellow), and 0.25 (brown).
Activity
PaulWessel commentedon Sep 10, 2022
Before I look at this, isn't it reasonable that the data need to be sorted from low to high in case of +v since it is cumulative x-values? If I fix the order, I get
We can either state this in the docs or (probably better) do a sort when +v is set ,but seems odd to me to give the data not sorted.
PaulWessel commentedon Sep 11, 2022
I mean, the data and use for this type of symbol might be categorical thinks with different values, and it makes absolutely no sense to me to if the values relative to base are not sorted. What am I misunderstanding here?
yvonnefroehlich commentedon Sep 11, 2022
Thanks for your response @PaulWessel!
There is nothing wrong with sorting the values before plotting them for this type of symbol or bar plot.
My example is slightly modified from a planed PyGMT gallery example by @michaelgrund (bottom right panel, using
+vwithout+s), which seems to be based on an example in the GMT documentation. In the PyGMT example, the data is [currently] not sorted before plotting. No remark is stated, that this is partly necessary when using+v. Thus, as suggested by @PaulWessel, I feel comments in the GMT documentation and the example explanation, that users have to sort the data externally when using+vwithout+sbefore passing it to theplotmodule or method [as long this is not done byplot], would avoid confusion.Clarify items for bars should be sorted
seisman commentedon Sep 13, 2022
I don't think it makes sense to required a sorted data. For this example data, it's impossible to sort the two records at the same time.
PaulWessel commentedon Sep 13, 2022
For +i it is clearly required that the data are in the right order since sorting makes no sense. For +v I fail to see what sort of actual data would come with values in different columns. Maybe I just dont understand the use. Basically, the data given via +i cumulatively sum to give the required comparable input if +v is used. You cannot shuffle columns around. Your example above, is that really an actual data example of just an made-up example to demonstrate the plotting?
PaulWessel commentedon Sep 13, 2022
If anything, I think an error message might be the best option.
seisman commentedon Sep 13, 2022
This is just an made-up example data. I think for this kind of data, it makes more sense to use
+sto plot split bars instead.PaulWessel commentedon Sep 13, 2022
Yes, but again you probably want split bar number 2 to represent the same data column throughout.
joa-quim commentedon Sep 13, 2022
If I'm guessing right +v plots the bars from last to first, so if values are not sorted some bars will be completely hidden by some other(s). So, yes, data must absolutely be sorted.
yvonnefroehlich commentedon Sep 13, 2022
Thanks for all the thoughts on this topic!
Meaning for the data example
0.25 1 0.65 0.4 2.25the value0.4should be hidden by the value0.65, correct? But looking at the figure above, this seems not the case. There are sections for2.25(blue),0.4(yellow), and0.25(brown).Clarify items for bars should be sorted (#7025)