Menu

#1140 broken color palette with maxcolors option

closed-duplicate
nobody
2D plot (258)
5
2012-06-08
2012-06-07
No

In CVS version, the combination of palette options
"defined" and "maxcolors" causes broken color palette.

For example, the following code generates unequal sized
color scale for x11.

---
set palette defined ( 0 '#000090', \ 1 '#000fff', \ 2 '#0fffee', \ 3 '#90ff70', \ 4 '#ffee00', \ 5 '#ff7000', \ 6 '#7f0000')
set palette maxcolors 4
set cbrange [-1:1]
plot "+" using ($1):(sin($1)):(sin($1)) with points palette
pause -1
---

My environment is

G N U P L O T
Version 4.7 patchlevel 0    last modified 2012-05-21 
Build System: Darwin i386

Discussion

  • Hiroki Motoyoshi

    Screen shot drawn by sample script

     
  • Ethan Merritt

    Ethan Merritt - 2012-06-07
    • status: open --> open-duplicate
     
  • Ethan Merritt

    Ethan Merritt - 2012-06-07

    Duplicate of [invalid] Bug #3305600

    You must give the start and end point for each color range.
    maxcolors is not important, but it must be at least as large as the number of color ranges.
    I think the commands you want are:

    set palette defined ( 0 '#000090', 0 '#000090',\ 0 '#000fff', 1 '#000fff', \ 1 '#0fffee', 2 '#0fffee', \ 2 '#90ff70', 3 '#90ff70', \ 3 '#ffee00', 4 '#ffee00', \ 4 '#ff7000', 5 '#ff7000', \ 5 '#7f0000', 6 '#7f0000')

    set cbrange [-1:1]
    plot "+" using ($1):(sin($1)):(sin($1)) with points palette

     
  • Ethan Merritt

    Ethan Merritt - 2012-06-07

    Sorry. Typo in suggested palette definition. Try

    set palette defined ( \ -1 '#000090', 0 '#000090',\ 0 '#000fff', 1 '#000fff', \ 1 '#0fffee', 2 '#0fffee', \ 2 '#90ff70', 3 '#90ff70', \ 3 '#ffee00', 4 '#ffee00', \ 4 '#ff7000', 5 '#ff7000', \ 5 '#7f0000', 6 '#7f0000')

     
  • Hiroki Motoyoshi

    If you change maxcolors as large as color number specified in 'defined' such like,

    # set palette maxcolors 4
    set palette maxcolors 11

    it generate strange color palette.
    I'll attach the screenshot for this.

     
  • Hiroki Motoyoshi

    Screen shot for the case "maxcolors 11"

     
  • Hiroki Motoyoshi

    In addition, the problem occurs not only in terminal X11 but also in other terminals (wxt, pdfcairo, pdf, gif).

     
  • Hiroki Motoyoshi

    All right, this bug report pointed out same problem with #3305600.

    Please close this report.

     
  • Ethan Merritt

    Ethan Merritt - 2012-06-08
    • status: open-duplicate --> closed-duplicate
     

Log in to post a comment.