Bug #1077

parameter parsing in custom symbol "marc"

Added by Jose about 1 year ago. Updated about 1 year ago.

Status:ClosedStart date:2017-04-03
Priority:NormalDue date:
Assignee:Paul% Done:


Target version:-
Affected version:5.x-svn Platform:Linux



I am trying to parse a parameter in a custom symbol using a math arc (m). When I specify the start and finish angles directly it works as expected, but when parsing from the parameters using $x it does not work.
I attach the symbol definitions with and without parsing, and the outputs.

Using release 17850


matharc.pdf (6.44 KB) Jose, 2017-04-03 00:32

matharc_fixed.pdf (6.5 KB) Jose, 2017-04-03 00:32

matharc-test.def (30 Bytes) Jose, 2017-04-03 00:32

matharc-test-fixed.def (30 Bytes) Jose, 2017-04-03 00:32

pruebo_simbolos.sh Magnifier (1001 Bytes) Jose, 2017-04-03 09:44

matharc-test.pdf (6.66 KB) Jose, 2017-04-03 09:44

geologic_symbols.pdf (9.32 KB) Jose, 2017-04-05 23:14


#1 Updated by Paul about 1 year ago

  • Status changed from New to Feedback

To simplify my life, could you please attach the test script so I can see the data format, etc.

#2 Updated by Jose about 1 year ago

Sure! Sorry Paul

I send you a familiar test script with the resulting pdf using the .def files that I sent before.


#3 Updated by Paul about 1 year ago

Thanks Jose. This needs some deeper thinking. I agree that all the symbols that take angles should be able to accept variables, but this is not presently implemented. It makes no sense to use variables for sizes since the symbol scales everything up, but the angles need to be more flexible. I need to come up with a scheme for this, hopefully tomorrow.

#4 Updated by Paul about 1 year ago

  • Status changed from Feedback to Resolved
  • Assignee set to Paul
  • % Done changed from 0 to 100

Now in r17878. All angles in the table of symbols can now be variables. Note the rotated rectangle symbol j was missing from the macro definition table.

#5 Updated by Jose about 1 year ago

Thanks Paul!!

Now it works as expected. I send you a figure with the symbols I am doing (the number 5 shows the arc with the angle parsed). I need to incorporate around a dozen more but finally we will have the most relevant symbols used in geological mapping available in GMT! something that neither the specialized GIS have.

Is it ok if I share them through the GMT forums? Do you think that they could be incorporated into the distributed GMT custom symbols?

All the best

#6 Updated by Paul about 1 year ago

Hi Jose-

Beautiful. Sure, you can share on the forum but I think we can do better by adding a Resources tab on our wiki and place such symbols. I will see what I can do [teaching this morning]. Meanwhile, keep at it and I will work on a solution for this. For instance, we have not yet put up the biological symbols someone made for GMT4 macros [http://gmt.soest.hawaii.edu/gmt4/gmt/contrib/gmt_cetaceans.html] so a Resource page is overdue.

#7 Updated by Joaquim about 1 year ago

#8 Updated by Paul about 1 year ago

That's right! (Forgot). Well, we need to import all those fish symbols from the GMT4 page over as welll.

#9 Updated by Paul about 1 year ago

Just letting you know that in r17901 I allow the argument to -W inside macros to be either a typical pen thickness (e.g., 0.5p), and normalized pen thickness (0-1, e.g., -W0.02) which becomes scaled by the symbol size, or a variable (e.g., -W$1) which is replaced at run-time by that data column. It may be better to have normalized pen thicknesses sometimes so that they scale with the symbol size.

#10 Updated by Jose about 1 year ago

Thank you very much Paul. The more the flexibility of the macros the crazier the things we can think of!

Another useful addition could be the capacity to fix the fill of a polygon or symbol to the same color of the employed pen. For example, I have done an arrow with a line and a triangle and in order to have the triangle filled I have to use -G in psxy, which affects too to the other symbols and text (the other option is to fix the color in the macro). It would be great if the fill of the triangle could be assigned to the color of the pen used with something like "-Gpen" in the macro.

All the best

#11 Updated by Paul about 1 year ago

Good idea, I will see how this can be added. You mean the color of the pen supplied via -W<pen> on the command line?

#12 Updated by Jose about 1 year ago

Yes! In that way we can make the basic parts of the symbol with the same color and then we can play with the fill color for other parts of the symbol, or for the text, independently.


#13 Updated by Paul about 1 year ago

Updated in r17909. You can now give -G+p to pick the fill color from the current pen color, and -W[parameters]+g to replace the pen color with that of the current fill. I have also improved the custom symbols documentation for the outline and fill settings.

#14 Updated by Paul about 1 year ago

  • Status changed from Resolved to Closed

Closing this issue as fully implemented.

Also available in: Atom PDF