3

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

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Mika Ike
  • 3,241
  • 1
  • 23
  • 38

3 Answers3

5

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

e.doroskevic
  • 5,959
  • 1
  • 13
  • 32
  • 1
    Can I ask why your rolled back my edit when it provided a fuller answer? – Feyre Aug 16 '16 at 08:50
  • @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 :) – e.doroskevic Aug 16 '16 at 09:09
2

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

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
1

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]
Mika Ike
  • 3,241
  • 1
  • 23
  • 38