|
From: Seoane A. T. <ts...@e-...> - 2010-06-14 10:49:36
|
Hello! I have a problem, long to explain, but not complex to understand: I am trying to plot with image a data matrix with the following properties: - The valid data goes from 0 to 1. - There exist invalid data, which has a z value of 2. - The palette range will be [0:0.01] I want 29 colors to be used in the palette, and so, I use this script: set cbrange [0:0.01] set palette model RGB defined ( 0 "#8b0000", 1 "#8b0000", 1 "#a80000", 2 "#a80000", 2 "#c50000", 3 "#c50000", 3 "#e20000", 4 "#e20000", 4 "#ff0000", 5 "#ff0000", 5 "#ff2900", 6 "#ff2900", 6 "#ff5300", 7 "#ff5300", 7 "#ff7c00", 8 "#ff7c00", 8 "#ffa500", 9 "#ffa500", 9 "#ffbc00", 10 "#ffbc00", 10 "#ffd200", 11 "#ffd200", 11 "#ffe900", 12 "#ffe900", 12 "#ffff00", 13 "#ffff00", 13 "#bfff00", 14 "#bfff00", 14 "#7fff00", 15 "#7fff00", 15 "#40ff00", 16 "#40ff00", 16 "#00ff00", 17 "#00ff00", 17 "#00ff40", 18 "#00ff40", 18 "#00ff80", 19 "#00ff80", 19 "#00ffbf", 20 "#00ffbf", 20 "#00ffff", 21 "#00ffff", 21 "#00bfff", 22 "#00bfff", 22 "#0080ff", 23 "#0080ff", 23 "#0040ff", 24 "#0040ff", 24 "#0000ff", 25 "#0000ff", 25 "#0000e2", 26 "#0000e2", 26 "#0000c5", 27 "#0000c5", 27 "#0000a8", 28 "#0000a8", 28 "#00008b", 29 "#00008b" ) set view map splot 'matrix.txt' with image With this script, all the valid data from 0.01 to 1 will have the last color of the palette, which is OK, but the invalid data will have that color too, but I would like those data points to have another color. Is there any simple way to achieve this, like skipping the points with certain z values? As I could not find a simple solution, I have tried the next more or less complex approach which "almost" works: - Redefine the palette range to include the invalid data. - Redefine the palette with its real range values to have the same colors than before for the same values. set cbrange [0:2] set palette model RGB defined ( a "#8b0000", b "#8b0000", b "#a80000", c "#a80000", c "#c50000", d "#c50000", d "#e20000", e "#e20000", e "#ff0000", f "#ff0000", f "#ff2900", g "#ff2900", g "#ff5300", h "#ff5300", h "#ff7c00", i "#ff7c00", i "#ffa500", j "#ffa500", j "#ffbc00", k "#ffbc00", k "#ffd200", l "#ffd200", l "#ffe900", m "#ffe900", m "#ffff00", n "#ffff00", n "#bfff00", o "#bfff00", o "#7fff00", p "#7fff00", p "#40ff00", q "#40ff00", q "#00ff00", r "#00ff00", r "#00ff40", s "#00ff40", s "#00ff80", t "#00ff80", t "#00ffbf", u "#00ffbf", u "#00ffff", v "#00ffff", v "#00bfff", w "#00bfff", w "#0080ff", x "#0080ff", x "#0040ff", y "#0040ff", y "#0000ff", z "#0000ff", z "#0000e2", a1 "#0000e2", a1 "#0000c5", b1 "#0000c5", b1 "#0000a8", c1 "#0000a8", c1 "#00008b",1 .1 "#00008b", 1.1 "#bebebe", 2 "#bebebe" ) set view map splot 'matrix.txt' with image Where the parameters "a" to "c1" has the next value: 0. + 0.01 * i / 29. i=0, 1, 2, ... The problem with this is that not all colors are used, but I have found that if the palette range is smaller, it works OK, so maybe is a gnuplot bug or limitation. Anyway, I cannot do the range smaller, as there would be valid data with the color of invalid data (in the example there is no valid data from 0.01 to 1, so it is perfect, but not always will be this way). This would be the script for the limited range that works: set cbrange [0:.05] set palette model RGB defined ( a "#8b0000", b "#8b0000", b "#a80000", c "#a80000", c "#c50000", d "#c50000", d "#e20000", e "#e20000", e "#ff0000", f "#ff0000", f "#ff2900", g "#ff2900", g "#ff5300", h "#ff5300", h "#ff7c00", i "#ff7c00", i "#ffa500", j "#ffa500", j "#ffbc00", k "#ffbc00", k "#ffd200", l "#ffd200", l "#ffe900", m "#ffe900", m "#ffff00", n "#ffff00", n "#bfff00", o "#bfff00", o "#7fff00", p "#7fff00", p "#40ff00", q "#40ff00", q "#00ff00", r "#00ff00", r "#00ff40", s "#00ff40", s "#00ff80", t "#00ff80", t "#00ffbf", u "#00ffbf", u "#00ffff", v "#00ffff", v "#00bfff", w "#00bfff", w "#0080ff", x "#0080ff", x "#0040ff", y "#0040ff", y "#0000ff", z "#0000ff", z "#0000e2", a1 "#0000e2", a1 "#0000c5", b1 "#0000c5", b1 "#0000a8", c1 "#0000a8", c1 "#00008b", .03 "#00008b", .03 "#bebebe", .05 "#bebebe" ) set view map splot 'matrix.txt' with image I would be very grateful if anyone could give me a solution! I have attached 3 images for the 3 scripts so you can see the problem. Thanks! Teodoro Seoane -------------------------------------------------------------------------- Advertencia / Confidentiality Notice Este envio es confidencial y esta destinado unicamente a la persona a la que ha sido enviado. Puede contener informacion privada y confidencial. Si usted no es el destinatario al que ha sido remitida, no puede copiarla, distribuirla ni emprender con ella ningun tipo de accion. Si cree que lo ha recibido por error, por favor, notifiquelo al remitente. This transmission is confidential and intended solely for the person to whom it is addressed. It may contain privileged and confidential information. If you are not the intended recipient, you should not copy, distribute or take any action in reliance on it. If you believe that you have received this transmission in error, please notify the sender. Aeropuertos Espanoles y Navegacion Aerea |