change color pallette to better show distinctive colors
The old method of creating brighter/darker colors was producing color shades that did not look like the same color. E.g. a darker yellow looked more like brown. I am now trying to use hand crafted shades.
This commit is contained in:
@@ -84,7 +84,7 @@ public class BarChartHandler extends AggregateHandler {
|
|||||||
gnuplotTitle(title), //
|
gnuplotTitle(title), //
|
||||||
GnuplotLineType.Bar, //
|
GnuplotLineType.Bar, //
|
||||||
gnuplotXYAxis(), //
|
gnuplotXYAxis(), //
|
||||||
lineStyle.brighter()//
|
lineStyle.asGnuplotLineStyleBright()//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class CumulativeDistributionHandler extends AggregateHandler {
|
|||||||
aggregatedData.getDataFile().getAbsolutePath(), //
|
aggregatedData.getDataFile().getAbsolutePath(), //
|
||||||
gnuplotTitle(title), //
|
gnuplotTitle(title), //
|
||||||
gnuplotXYAxis(), //
|
gnuplotXYAxis(), //
|
||||||
lineStyle.darker()//
|
lineStyle.asGnuplotLineStyleBright()//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class HistogramHandler extends AggregateHandler {
|
|||||||
aggregatedData.getDataFile().getAbsolutePath(), //
|
aggregatedData.getDataFile().getAbsolutePath(), //
|
||||||
gnuplotTitle(title), //
|
gnuplotTitle(title), //
|
||||||
gnuplotXYAxis(), //
|
gnuplotXYAxis(), //
|
||||||
lineStyle.darker()//
|
lineStyle.asGnuplotLineStyleDark()//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class ParallelRequestsAggregate extends AggregateHandler {
|
|||||||
aggregatedData.getDataFile().getAbsolutePath(), //
|
aggregatedData.getDataFile().getAbsolutePath(), //
|
||||||
gnuplotTitle(title), //
|
gnuplotTitle(title), //
|
||||||
gnuplotXYAxis(), //
|
gnuplotXYAxis(), //
|
||||||
lineStyle.brighter().asGnuplotLineStyle()//
|
lineStyle.asGnuplotLineStyleDark()//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,55 +1,33 @@
|
|||||||
package org.lucares.recommind.logs;
|
package org.lucares.recommind.logs;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
|
|
||||||
public class GnuplotColor {
|
public class GnuplotColor {
|
||||||
private final String color; // hex: 00efcc
|
|
||||||
|
|
||||||
private GnuplotColor(String color) {
|
private final String bright, normal, dark; // hex: 00efcc
|
||||||
this.color = color;
|
|
||||||
|
private GnuplotColor(final String bright, final String normal, final String dark) {
|
||||||
|
this.bright = bright;
|
||||||
|
this.normal = normal;
|
||||||
|
this.dark = dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GnuplotColor byHex(String aHex) {
|
public static GnuplotColor byHex(final String bright, final String normal, final String dark) {
|
||||||
return new GnuplotColor(aHex);
|
return new GnuplotColor(bright, normal, dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GnuplotColor byAwtColor(Color color) {
|
public String getBright() {
|
||||||
|
return bright;
|
||||||
final String hex = String.format("%02x%02x%02x", //
|
|
||||||
color.getRed(), //
|
|
||||||
color.getGreen(), //
|
|
||||||
color.getBlue()//
|
|
||||||
);
|
|
||||||
|
|
||||||
return new GnuplotColor(hex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getColor() {
|
public String getColor() {
|
||||||
return "rgb \"#" + color + "\"";
|
return normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDark() {
|
||||||
|
return dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getColor();
|
return getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color toAwtColor() {
|
|
||||||
int red = Integer.parseInt(color.substring(0, 2), 16);
|
|
||||||
int green = Integer.parseInt(color.substring(2, 4), 16);
|
|
||||||
int blue = Integer.parseInt(color.substring(4, 6), 16);
|
|
||||||
return new Color(red, green, blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GnuplotColor brighter() {
|
|
||||||
|
|
||||||
final Color brighterColor = toAwtColor().brighter();
|
|
||||||
|
|
||||||
return byAwtColor(brighterColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GnuplotColor darker() {
|
|
||||||
|
|
||||||
final Color darkerColor = toAwtColor().darker();
|
|
||||||
return byAwtColor(darkerColor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,27 +24,24 @@ public interface GnuplotColorPalettes {
|
|||||||
* <div style="background-color: #FF69B4; display:inline; padding:
|
* <div style="background-color: #FF69B4; display:inline; padding:
|
||||||
* 8px;">#FF69B4</div>
|
* 8px;">#FF69B4</div>
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
List<GnuplotColor> GNUPLOT = Arrays.asList(//
|
* List<GnuplotColor> GNUPLOT = Arrays.asList(// GnuplotColor.byHex("9400D3"),
|
||||||
GnuplotColor.byHex("9400D3"), // purple
|
* // purple GnuplotColor.byHex("009e73"), // green
|
||||||
GnuplotColor.byHex("009e73"), // green
|
* GnuplotColor.byHex("56b4e9"), // light blue GnuplotColor.byHex("e69f00"), //
|
||||||
GnuplotColor.byHex("56b4e9"), // light blue
|
* orange GnuplotColor.byHex("f0e442"), // yellow GnuplotColor.byHex("0072b2"),
|
||||||
GnuplotColor.byHex("e69f00"), // orange
|
* // blue GnuplotColor.byHex("e51e10"), // red GnuplotColor.byHex("FF69B4")//
|
||||||
GnuplotColor.byHex("f0e442"), // yellow
|
* magenta );
|
||||||
GnuplotColor.byHex("0072b2"), // blue
|
*/
|
||||||
GnuplotColor.byHex("e51e10"), // red
|
|
||||||
GnuplotColor.byHex("FF69B4")// magenta
|
|
||||||
);
|
|
||||||
|
|
||||||
List<GnuplotColor> GNUPLOT_REORDERED = Arrays.asList(//
|
List<GnuplotColor> GNUPLOT_REORDERED = Arrays.asList(//
|
||||||
GnuplotColor.byHex("0072b2"), // blue 00A2FF, 0091E6, 0072B2, 005180, 002840
|
GnuplotColor.byHex("0060e6", "0051c2", "003580"), // blue 006aff, 0060e6, 0051c2, 003580, 001b40
|
||||||
GnuplotColor.byHex("e69f00"), // orange FFAE00, E69F00, BF8300, 805700, 402C00
|
GnuplotColor.byHex("E69F00", "BF8300", "805700"), // orange FFAE00, E69F00, BF8300, 805700, 402C00
|
||||||
GnuplotColor.byHex("9400D3"), // purple B300FF, A100E6, 9400D3, 590080, 2D0040
|
GnuplotColor.byHex("A100E6", "9400D3", "590080"), // purple B300FF, A100E6, 9400D3, 590080, 2D0040
|
||||||
GnuplotColor.byHex("009e73"), // green
|
GnuplotColor.byHex("00e663", "00c254", "008037"), // green
|
||||||
GnuplotColor.byHex("f0e442"), // yellow
|
GnuplotColor.byHex("FFFF00", "E6e600", "c2c200"), // yellow
|
||||||
GnuplotColor.byHex("e51e10"), // red
|
GnuplotColor.byHex("FF2200", "e51e10", "C211a00"), // "FF2200","e51e10","C211a00","801100","400800"
|
||||||
GnuplotColor.byHex("56b4e9"), // lightblue
|
GnuplotColor.byHex("67bee6", "57a1c2", "396980"), // "73d3ff", "67bee6", "57a1c2","396980","1d3540"
|
||||||
GnuplotColor.byHex("FF69B4")// magenta
|
GnuplotColor.byHex("E040E6", "BD36C2", "7C2480")// "F947FF", "E040E6", "BD36C2", "7C2480", "3E1240"
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,15 +64,13 @@ public interface GnuplotColorPalettes {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
List<GnuplotColor> MATPLOTLIB = Arrays.asList(//
|
/*
|
||||||
GnuplotColor.byHex("1f77b4"), // blue
|
* List<GnuplotColor> MATPLOTLIB = Arrays.asList(//
|
||||||
GnuplotColor.byHex("ff7f0e"), // orange
|
* GnuplotColor.byHex("1f77b4"), // blue GnuplotColor.byHex("ff7f0e"), // orange
|
||||||
GnuplotColor.byHex("d62728"), // red
|
* GnuplotColor.byHex("d62728"), // red GnuplotColor.byHex("2ca02c"), // green
|
||||||
GnuplotColor.byHex("2ca02c"), // green
|
* GnuplotColor.byHex("fdbb6c"), // light orange GnuplotColor.byHex("b3df72"),
|
||||||
GnuplotColor.byHex("fdbb6c"), // light orange
|
* // light green GnuplotColor.byHex("feffbe")// light yellow );
|
||||||
GnuplotColor.byHex("b3df72"), // light green
|
*/
|
||||||
GnuplotColor.byHex("feffbe")// light yellow
|
|
||||||
);
|
|
||||||
|
|
||||||
List<GnuplotColor> DEFAULT = GNUPLOT_REORDERED;
|
List<GnuplotColor> DEFAULT = GNUPLOT_REORDERED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,23 +10,28 @@ public class LineStyle {
|
|||||||
this.dashType = dashType;
|
this.dashType = dashType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String asGnuplotLineStyle() {
|
private String asGnuplotLineStyle(final String colorHex) {
|
||||||
return String.format("lt %s dt %s ", //
|
return String.format("lt rgb \"#%s\" dt %s ", //
|
||||||
color.getColor(), //
|
colorHex, //
|
||||||
dashType.toGnuplotDashType()//
|
dashType.toGnuplotDashType()//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String asGnuplotLineStyleBright() {
|
||||||
|
return asGnuplotLineStyle(color.getBright());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String asGnuplotLineStyle() {
|
||||||
|
return asGnuplotLineStyle(color.getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String asGnuplotLineStyleDark() {
|
||||||
|
return asGnuplotLineStyle(color.getDark());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return asGnuplotLineStyle();
|
return asGnuplotLineStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LineStyle brighter() {
|
|
||||||
return new LineStyle(color.brighter(), dashType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LineStyle darker() {
|
|
||||||
return new LineStyle(color.darker(), dashType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user