Fill in polygon color

Is there any way to fill in a closed polygon using color palette?

If you mean a constant color selected from a CPT, the answer is yes. It is explained in the psxy (plot) manual.

I mean like plot symbol using -C. I have a value for each polygon and I want to fill polygon using color pallete.

Yes, you can fill your polygon using -C by assigning a z value to the header records of each polygon. Generally, you data looks like:

> -Z0
0 0 
1 1
2 2
> -Z3.4
3 3
4 5
6 8

Please refer to https://docs.generic-mapping-tools.org/dev/plot.html#segment-header-parsing for more details.

Or, like the manual explains

-C cpt

Give a CPT or specify -C color1,color2 [ ,color3 ,…] to build a linear continuous CPT from those colors automatically, where z starts at 0 and is incremented by one for each color. In this case color n can be a r/g/b triplet, a color name, or an HTML hexadecimal color (e.g. #aabbcc ). If -S is set, let symbol fill color be determined by the z-value in the third column.

But that is for symbols. However -W seems to have it too

-W [ pen ][ attr ] [(more …)]

Set pen attributes for lines or the outline of symbols [Defaults: width = default, color = black, style = solid]. If the modifier +cl is appended then the color of the line are taken from the CPT (see -C ). If instead modifier +cf is appended then the color from the cpt file is applied to symbol fill.

Thanks for the help @seisman @Joaquim. :pray: