Menu ▾ ▴

#2900 Extra input column messes with dashtype

None
open-not-a-bug
nobody
None
2026-10-26
2026-10-22
No

Hey,

A third input column for colouring messes with the dashtype if the density of data points is too high (i.e. points are closer than the empty segment of the dashtype)

#Example 1 works as expected:
set sample 1000
plot "+" u 1:(sin($1)) w l lc 8 dt 2
#Example 2 works as expected:
set sample 100
plot "+" u 1:(sin($1)):1 w l lc pal dt 2
#Example 3 shows (almost) continues lines:
set sample 1000
plot "+" u 1:(sin($1)):1 w l lc pal dt 2

I'm using Gnuplot v6.0.5

Cheers,
Alex

Discussion

  • Ethan Merritt

    Ethan Merritt - 2026-10-24

    The output will depend on the terminal type that is selected.

    For a few terminals, gnuplot manages both the color and the dash pattern in dedicated code. In these cases you can have both at the same time. I think this means that right now you could use svg, postscript, or (in gnuplot 6.1) any of the libgd-based terminals. I attach PNG output from version 6.1 using the libgd png terminal

    For the cairo-based terminals and Qt, gnuplot passes the desired properties to an external library and what you see is whatever that library provides.

    Do you have a real need for multi-colored dashed lines?

     
  • Ethan Merritt

    Ethan Merritt - 2026-10-24
    • status: open --> open-not-a-bug
    • Group: -->
    • Priority: -->
     
  • Alexander Stangl

    My bad. I tested with two terminals and got the same result so i wrongly presumed its a gnuplot related issue, but thanks for clarification.
    its indeed useful to me, however lc rgb palette(z) is a suitable workaround (same color within a single datablock)

     
    • Ethan Merritt

      Ethan Merritt - 2026-10-26

      It might be possible to re-order or otherwise modify the calls into the cairo library in such a way that changing the color preserved the current state of dot/dash position within a longer path. Might be. I'm not sure. I tried the stupid-but-easy change of replacing cairo_stroke() with cairo_stroke_preserve(), but that did not work at all. Perhaps someone with more cairo experience either knows how to do it or knows it can't be done.

       
      👍
      1

Log in to post a comment.