3
$\begingroup$

I want to swap two colors in a bullet gauge.

Is this possible to do this without using something similar to

BulletGauge[{1, 1.8, 3, 3.4, 4, 5}, {2.4, 2.9}, {0, 3.5, 4.8}, 
  ImageSize -> Large, 
  GaugeStyle -> {Red, Blue, Green, Purple, Orange, LightBlue}]

enter image description here

$\endgroup$
  • $\begingroup$ What is undesirable about the solution you yourself suggested? $\endgroup$ – Quantum_Oli Aug 16 '16 at 8:34
  • $\begingroup$ @Quantum_Oli I think that is smarter use the a swaping of the 5th color with the 6th color, using the numser 5 and 6 of a list, and not defining a color with RGB, which is longer. $\endgroup$ – Mika Ike Aug 16 '16 at 8:36
  • $\begingroup$ Related: (57133) $\endgroup$ – Mr.Wizard Aug 16 '16 at 9:03
2
$\begingroup$

If we somehow know in advance the colors that are being used a post-processing replacement is possible.

swapIndexed[i_, c1_, c2_] := {# -> #2, #2 -> #} & @@ (ColorData[i] /@ {c1, c2})

BulletGauge[
  {1, 1.8, 3, 3.4, 4, 5}, {2.4, 2.9}, {0, 3.5, 4.8}
  , ImageSize -> Large
] /. swapIndexed[63, 5, 6]

enter image description here

| improve this answer | |
$\endgroup$
5
$\begingroup$

Description

Simply change the order of colors in GaugeStyle

Example

BulletGauge[{1, 1.8, 3, 3.4, 4, 5}, {2.4, 2.9}, {0, 3.5, 4.8}, 
 ImageSize -> Large, 
 GaugeStyle -> {Red, Blue, Green, Purple, Orange, LightBlue}]

BulletGauge[{1, 1.8, 3, 3.4, 4, 5}, {2.4, 2.9}, {0, 3.5, 4.8}, 
 ImageSize -> Large, 
 GaugeStyle -> {Red, Blue, Green, Purple, LightBlue, Orange}]

Output

ex1 ex2

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Can I ask why your rolled back my edit when it provided a fuller answer? $\endgroup$ – Feyre Aug 16 '16 at 8:50
  • $\begingroup$ @Feyre the edit you've made did indeed provide a solution. Therefore I thought it would be best if you'd add it as such which would grant you extra reputation points as oppose of me taking credit for your solution :) $\endgroup$ – e.doroskevic Aug 16 '16 at 9:09
1
$\begingroup$

without using a swaping function.... (I don´t remeber/know native swaping function).....

gs = Table[ColorData[63, i], {i, 1, Length [ColorData[63, "ColorList"]]}]

BulletGauge[{1, 1.8, 3, 3.4, 4, 5}, {2.4, 2.9}, {0, 3.5, 4.8},  ImageSize-> Large, GaugeStyle -> gs]
temp = gs[[5]];
gs[[5]] = gs[[6]];
gs[[6]] = temp;
gs

BulletGauge[{1, 1.8, 3, 3.4, 4, 5}, {2.4, 2.9}, {0, 3.5, 4.8}, ImageSize -> Large, GaugeStyle -> gs]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.