psxy -Sql breaks polygon plotting
|Target version:||Candidate for next bugfix release|
Based on my forum post:
Plotting a polygon from a list of coordinates causes reliably reproducible artifacts when labels are added. This seems to be independent from projection type. I tested it with
-JL (Lambert conic conformal projection) and
-JM (Mercator projection). For illustrating purposes I attached a bare bones test script.
A connecting line is plotted between the two points where the polygon crosses the plots boundary. In the image below, the diagonal line running from the upper to the right border appears only when a label via
-Sql is placed. When the option is omitted, the polygon is plotted as desired (only the vertical and the horizontal part of the red polygon).
The usage of the
-Sql option should not alter the shape of the polygon to be plotted.
After some experimenting I boiled the requirements down to:
- closed polygon (first & last coordinate identical)
- polygon only partly in plot area
- joint of polygon inside plot area
- label added with
This reliably reproduces the line artifacts on the polygon. If the label is omitted, the polygon gets plotted correctly.
In the test script attached below:
- 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.
GMT Version 5.2.0_r13750 [64-bit] [4 cores]
Ubuntu 12.04.5 LTS (GNU/Linux 2.6.32-042stab094.7 x86_64)
Hopefully this gives you enough information for hunting down the bug. As my bugs become quickly fixed and my questions are patiently answered I'd like to say thank you for your work on the GMT collection. Gentlemen, you rock!
All the best,
#1 Updated by Paul about 3 years ago
- Status changed from New to Resolved
- Assignee set to Paul
- Target version set to Candidate for next bugfix release
The quote line machinery did not check if clipping caused the original line to be chopped into 2 or more pieces. I have added code to handle that; please see if it works for you as well. In r13773.
#2 Updated by Paul about 3 years ago
Your example highlighted an ugly blight in GMT: When a polygon is clipped it sometimes is returned as two individual line segments that actually share a common point, yet plotting them separately can give an ugly notch at the joint point if there is an angle there (as in your case). I have implemented a solution that shuffles such two segments into order and thus yields a single line. Have a look at your case now, In r13775.