psxy: add a label and things go wrong?

Added by Kristof about 5 years ago

I try to get rid of a weird behavior of psxy when used with the -Sql option: In a special case, which I was not able to reproduce with other data, the polygon becomes incorrectly plotted when a label via -Sql is added.

I'm plotting a polygon which isn't completely in the plot. Some coordinates lie outside the visible area. Please see attached test script and example output. Normal and expected behavior is shown by the blue and yellow polygon in the upper left corner. The special case is the green and red polygon in the lower right corner. When I plot it without labels everything is fine (green line), but when a label is added (red line), the polygon is closed with a direct line between the points where the polygon crosses the plot boundary. The data doesn't contain any poles.

Am I missing something and this is another case of PEBKAC or is it something else? Your input is appreciated.

I'm running GMT Version 5.2.0_r13690 [64-bit] [4 cores]

All the best,
Kristof

psxy_label.sh Magnifier - test script (1.58 KB)

psxy_label.pdf - output of test script (9.45 KB)


Replies (4)

RE: psxy: add a label and things go wrong? - Added by Kristof about 5 years ago

Well, I found another set of coordinates which produce the unwanted behavior. Please see attached script.

I have no explanation for this and would be glad if somebody could help me fix this behavior.

Thank you & all the best,
Kristof

psxy_label_2.sh Magnifier - example script showing both bad examples (3.15 KB)

psxy_label_2.pdf - output of example script (10.2 KB)

RE: psxy: add a label and things go wrong? - Added by Kristof about 5 years ago

I was able to narrow down the problem even further - I can now reliably produce the unwanted behavior.

Required for reproduction:

  • closed polygon (first & last coordinate identical)
  • polygon only partly in plot area
  • joint of polygon inside plot area
  • add a label with -Sql

I tried reading and understanding the source code but I have to admit that this is out of my league. I made another example script:

  • The polygons on the left (blue & green) have their joint outside the plot.
  • The polygons on the right (red & brown) have their joint inside the plot.

Please note the upper right red polygon failing.

As manipulating the source code is above my abilities I appreciate your help.

All the best,
Kristof

psxy_label_3.sh Magnifier - test script showing all four possible cases (1.29 KB)

psxy_label_3.pdf - output of test script (19.7 KB)

RE: psxy: add a label and things go wrong? - Added by Paul about 5 years ago

Thanks Kristof, this is really useful. Thanksgiving here and other stuff prevents me from working on this right away, and soon AGU comes and gotta work on my presentations....But it is in the queue. Actually, better if you could create a new issue of this - I believe you can refer to the message via a link?

RE: psxy: add a label and things go wrong? - Added by Kristof about 5 years ago

Hi Paul,

I created issue #651. Happy Thanksgiving to you (I forgot about that, not celebrated in Germany) and good luck for your presentations.

All the best,
Kristof

(1-4/4)