|
From: Petr M. <mi...@ph...> - 2005-11-07 18:20:12
|
This is an old bug (August 2004, see below). What do you think nowadays about fixing it? Petr *** There is a bug in the color palette treatment in the X11 terminal: when using multiple X11 terminals, window redraw (requested e.g. by a window manager) will change its palette. Try this script: set pm3d map set term x11 10 set title '10 gray levels' set palette gray set palette maxcolors 10 splot x*x set term x11 2 set title '2 colors' set palette color set palette maxcolors 2 splot x Now, maximize or resize window #10 by mouse => it will change from gray map with 10 gray levels to color map with 2 colors. >> Yes, every x11 windows should have its own copy of the palette. When there >> is a new (re)plot, x11 should copy the current gnuplot palette into palette >> of the active window, and use that. > > I don't like hacking stuff, and this may take some consideration. I'm > wondering how this should be structured, and whether we should be > conservative with palette usage in order to not consume too much memory. Are > palettes memory consumers? If so, it might be wise to not save a color map > with every plot. That is, say there is a fairly large palette, and then > someone creates twenty plots. If all those plots have a similar palette, it > may be an inefficient use of memory. > > Rather, it might be wise to have a linked-list of palettes. Whenever a new > palette is created, it is put in the linked list. Then, when a palette is > changed at the gnuplot command line, gplt_x11.c will search through the plot > list and see if any of the plots is using the old palette. If not, that > color map can be discarded from the list. > > It sounds unnecessarily tedious, but it really does seem like the thing to > do, and it actually might simplify the various uses of XAllocColor and > XFreeColors. |