Credits Overview Plotting Styles Commands Terminals

dashtype

The dash pattern (dashtype) is a separate property associated with each line, analogous to linecolor or linewidth. It is not necessary to place the current terminal in a special mode just to draw dashed lines. I.e. the command set term <termname> {solid|dashed} is now ignored. If backwards compatibility with old scripts written for version 4 is required, the following lines can be used instead:

     if (GPVAL_VERSION >= 5.0) set for [i=1:9] linetype i dashtype i
     if (GPVAL_VERSION < 5.0) set termoption dashed

All lines have the property dashtype solid unless you specify otherwise. You can change the default for a particular linetype using the command set linetype so that it affects all subsequent commands, or you can include the desired dashtype as part of the plot or other command.

Syntax:

      dashtype N          # predefined dashtype invoked by number
      dashtype "pattern"  # string containing a combination of the characters
                          # dot (.) hyphen (-) underscore(_) and space.
      dashtype (s1,e1,s2,e2,s3,e3,s4,e4)  # dash pattern specified by 1 to 4
                          # numerical pairs <solid length>, <emptyspace length>

Example:

      # Two functions using linetype 1 but distinguished by dashtype
      plot f1(x) with lines lt 1 dt solid, f2(x) with lines lt 1 dt 3

Some terminals support user-defined dash patterns in addition to whatever set of predefined dash patterns they offer.

Examples:

     plot f(x) dt 3            # use terminal-specific dash pattern 3
     plot f(x) dt ".. "        # construct a dash pattern on the spot
     plot f(x) dt (2,5,2,15)   # numerical representation of the same pattern
     set dashtype 11 (2,4,4,7) # define new dashtype to be called by index
     plot f(x) dt 11           # plot using our new dashtype

If you specify a dash pattern using a string the program will convert this to a sequence of <solid>,<empty> pairs. Dot "." becomes (2,5), dash "-" becomes (10,10), underscore "_" becomes (20,10), and each space character " " adds 10 to the previous <empty> value. The command show dashtype will show both the original string and the converted numerical sequence.