Menu

#1423 Postscript terminal draws circles with white border

closed-fixed
nobody
None
5
2015-03-23
2014-06-11
No

The following script draws a circle with a white border instead of a black one:

set terminal postscript eps
set output 'circlecolor.eps'
set object circle at first 0,0 radius first 1 lw 5 fs empty border lc rgb 'black' front
plot x lw 5

see the attached image. I could track this down to the commits of the 2013-09-26, but couldn't figure out where the problem actually is.

1 Attachments

Discussion

  • Ethan Merritt

    Ethan Merritt - 2014-06-12

    As best as I can figure it out, the problem comes down to a question of what the PostScript driver in "monochrome" mode should do with an rgb color spec.
    Version 4.6 allowed an explicit RGB color to be drawn even in monochrome mode.
    Version 5.0 does not except in the special case of "plot ... lc rgb variable".

    In this case the circle is first filled with background color because of "fs empty" and then the border color is set. Except that in version 5 for a monochrome terminal the command to set the color is skipped if it's an RGB color.

    One possible fix would be to adopt Henry Ford's policy: "any color you want so long as it's black". I.e. turn all RGB color requests into a request for black.

    Another possible fix might be to go back to the 4.6 policy - any explicit request for an RGB color overrides the monochrome setting. Unfortunately at the deeper code levels it is not possible to tell whether a color request originated from an explicit request or whether it just happens that we're using linetype N which has at some point been assigned an RGB color.

    Yet another possible fix would be to make object borders a special case. Even though colors in general are ignored in mono mode, we could allow object borders to force a color. I don't see a good argument for this other than it would be easier to implement than option 2 :-)

     

    Last edit: Ethan Merritt 2014-06-12
    • Christoph Bersch

      While working with the new dashtype parameter, which makes the solid|dashed terminal options superfluous, I was also thinking about the sense of the color|monochrome terminal options.

      Currently, using e.g. set terminal pngcairo monochrome only changes all default line colors to black. You'll also need to change the dashtypes with e.g. set for [i=1:8] lt i dt i to get reasonable line types. I'm not sure, what else the monochrome option affects (palette?). I tested with the set terminal pngcairo mono; set output 'test.png'; test palette, which seems to use the gray palette, although show palette still reports the palette to be COLOR.

      The reason for removing the solid|dashed parameters was, that one can switch between the two settings with set for [i=1:8] lt i dt i and set for [i=1:8] lt i dt 'solid'.

      In my opinion, the same applies to the color|monochrome options. To have all default lines black, one just must use set for [i=1:8] lt i lc -1. And, as I said above, you'll need to change the linetypes anyway to get dash patterns. But maybe I'm also missing something.

      I think, using the NTSC values for all colors, no matter how they were specified (palette, lc rgb, lt), would be my preferred solution. But I guess this would be a lot of work...

       
  • Bastian Märkisch

    Alternatively, we could also use the lumonisity

    Y = 0.2126 * R + 0.7152 * G + 0.0722 * B

    to convert any color request to grayscale. The windows terminal currently does that if mono output is requested. That way it is is easy to get a version for print-out.

     
  • Ethan Merritt

    Ethan Merritt - 2014-06-12

    You can do that already by customizing one line (OK 3 lines) in the PostScript prologue. It doesn't require any changes in the gnuplot core code.

    This used to be an FAQ, but maybe it hasn't been asked for a while.

    %%% Uncomment the following lines to get ntsc greyscale coloring
    % /ntsc { 0.114 mul exch 0.587 mul add exch 0.299 mul add } bind def
    % /setrgbcolor {ntsc setgray} bind def

     

    Last edit: Ethan Merritt 2014-06-12
  • Ethan Merritt

    Ethan Merritt - 2014-07-01
    • status: open --> pending
     
  • Ethan Merritt

    Ethan Merritt - 2014-07-04
    • status: pending --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB