@@ -2863,18 +2863,12 @@ EXTERN_MSC int GMT_psxy (void *V_API, int mode, void *args) {
28632863 if (polygon && Ctrl -> G .gradient ) {
28642864 /* Auto-detect gradient format based on GMT's column count */
28652865 if (Ctrl -> G .gradient ) {
2866- if (L -> n_columns == 5 ) {
2867- /* RGB format: x y r g b */
2866+ if (L -> n_columns == 5 ) /* RGB format: x y r g b */
28682867 Ctrl -> G .direct = true;
2869- }
2870- else if (L -> n_columns == 2 && L -> text && L -> text [0 ]) {
2871- /* Color string format: x y colorname (L->n_columns counts text as column 3) */
2868+ else if (L -> n_columns == 2 && L -> text && L -> text [0 ]) /* Color string format: x y colorname (L->n_columns counts text as column 3) */
28722869 Ctrl -> G .direct = true;
2873- }
2874- else if (L -> n_columns == 3 ) {
2875- /* CPT format: x y z (3 numeric columns) */
2870+ else if (L -> n_columns == 3 ) /* CPT format: x y z (3 numeric columns) */
28762871 Ctrl -> G .direct = false;
2877- }
28782872 }
28792873
28802874 /* Error check: CPT mode requires a color palette */
@@ -2886,8 +2880,7 @@ EXTERN_MSC int GMT_psxy (void *V_API, int mode, void *args) {
28862880 /* For gradients: need at least 3 vertices AND appropriate data format */
28872881 if (Ctrl -> G .gradient && L -> n_rows >= 3 &&
28882882 ((L -> n_columns == 5 && Ctrl -> G .direct ) || (L -> n_columns == 3 && !Ctrl -> G .direct && P ) || (L -> n_columns == 2 && L -> text && Ctrl -> G .direct ))) {
2889- double tri_rgb [9 ], rgb_tmp [4 ];
2890- double plot_x [3 ], plot_y [3 ];
2883+ double tri_rgb [9 ], rgb_tmp [4 ], plot_x [3 ], plot_y [3 ];
28912884
28922885 /* Project to map coordinates (use cart_to_xy if no clipping) */
28932886 if (no_line_clip )
@@ -2934,15 +2927,13 @@ EXTERN_MSC int GMT_psxy (void *V_API, int mode, void *args) {
29342927 GMT_Report (API , GMT_MSG_WARNING , "Failed to parse color '%s', using black\n" , L -> text [idx ]);
29352928 }
29362929 }
2937- else if (!Ctrl -> G .direct && L -> n_columns == 3 ) {
2938- /* CPT-based: z from column 3 */
2930+ else if (!Ctrl -> G .direct && L -> n_columns == 3 ) { /* CPT-based: z from column 3 */
29392931 gmt_get_rgb_from_z (GMT , P , L -> data [2 ][idx ], rgb_tmp );
29402932 tri_rgb [k * 3 + 0 ] = rgb_tmp [0 ];
29412933 tri_rgb [k * 3 + 1 ] = rgb_tmp [1 ];
29422934 tri_rgb [k * 3 + 2 ] = rgb_tmp [2 ];
29432935 }
2944- else {
2945- /* Fallback */
2936+ else { /* Fallback */
29462937 tri_rgb [k * 3 + 0 ] = tri_rgb [k * 3 + 1 ] = tri_rgb [k * 3 + 2 ] = 0.0 ;
29472938 }
29482939 }
@@ -2975,6 +2966,10 @@ EXTERN_MSC int GMT_psxy (void *V_API, int mode, void *args) {
29752966 gmt_geo_polygons (GMT , L );
29762967 }
29772968 }
2969+ else if (polygon && !no_line_clip ) { /* Want a closed polygon (with or without fill and with or without outline) */
2970+ gmt_setfill (GMT , & current_fill , outline_setting );
2971+ gmt_geo_polygons (GMT , L );
2972+ }
29782973 else if (S .symbol == GMT_SYMBOL_QUOTED_LINE ) { /* Labeled lines are dealt with by the contour machinery */
29792974 bool closed , split = false;
29802975 uint64_t k0 ;
0 commit comments