Menu

#2514 wgnuplot unable to plot dashed lines when setting terminal to jpeg

None
open-upstream-bug
nobody
None
2023-10-23
2022-03-30
Anonymous
No

If you try

set term jpeg
set out "1.jpg"
plot sin(x) w l dt 2
unset out

it will plot with solid line, which is not dt 2 but dt 1; However, if you set term win for example, it will correctly plot with dashed lines type 2. I've tried dt3 and others, but it always plots with dt 1

Discussion

  • Ethan Merritt

    Ethan Merritt - 2022-03-30

    This is due to a missing upstream feature. The libgd graphics support library does not currently support dot/dash patterns. Therefore the gnuplot terminal types that depend on libgd (png jpeg gif sixel) do not currently support dashtype as a line property.

    This is documented in the configuration and installation instructions, but yes it should probably be more clearly stated somewhere in the individual terminal "help" sections.

    Suggested alternative: set term pngcairo

     
  • Ethan Merritt

    Ethan Merritt - 2022-03-30
    • status: open --> open-upstream-bug
    • Group: -->
    • Priority: -->
     
  • Denis Gessert

    Denis Gessert - 2023-10-20

    I just started looking into this, so I am by no means a libgd expert. Isn't gdImageSetStyle (or possibly gdImageSetBrush) enough to implement dashed lines. From what I have read gdImageSetStyle is the preferred option to draw dashed lines (since gdImageDashedLine was deprecated although it still seems to be working)

     
    • Ethan Merritt

      Ethan Merritt - 2023-10-20

      That works adequately for purely horizontal or vertical lines, but fails badly for diagonal or curved lines. Don't believe what you read - try it.

       
  • Denis Gessert

    Denis Gessert - 2023-10-23

    I did actually try it but you are absolutely right: My test went as far as diagonal lines (which still works well by the way) but I would not know how to do curved lines without having to fall back to straight line dashes (which for most cases would not look acceptable). Thanks for the quick reply!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.