11

Originally posted in MathematicaMeta SE, titled "I can't understand why Mathematica has an excellent (perhaps the best!) BulletGauge command (with multiple options)", as a reflexion about the inconsistence of Mathematica has the best (comparing with other software) Bulletguage command BUT ONLY in HORIZONTAL!! without an option to make it VERTICAL nativelly

I can't understand why Mathematica has an excellent (perhaps the best!) BulletGauge command (with multiple options)

enter image description here

BUT.... only in horizontal!!!

AND it´s not available in Vertical!!

There is an SE-Solution (Stack Exchange Solution):

but

It's really a pity and I can't understand why is not available an option to do it in vertical.

Best regards. I don't know if this site is for this kind of opinions.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
Mika Ike
  • 3,241
  • 1
  • 23
  • 38
  • 2
    If you rephrase it too e.g. "how to create a vertical gauge? I was only able to find a horizontal one" then it will fit here well. – Kuba Jan 07 '18 at 09:46
  • 1
    I changed the question title as per Kuba's suggestion so that the question will be easier to find in the future, e.g. when searching on Google. – C. E. Jan 07 '18 at 11:34

2 Answers2

16

"GaugeOrigin"

Update: it turns out that there is an undocumented option "GaugeOrigin" that controls the orientation of the gauge.

BulletGauge[{42, 82}, {40, 68, 97}, {0, 100}, "GaugeOrigin" -> #, ImageSize ->Medium] & /@
   {Bottom, Top, Left, Right} // Row[#, Spacer[10]] &

enter image description here

In version 9, this produces the error message

OptionValue::nodef: Unknown option "GaugeOrigin" for BulletGauge

but gives the correct result. So you can suppress the error message using Quiet or use it a suboption of the option Method, i.e., Method -> {"GaugeOrigin" -> Bottom} works without complaint.

Update 2: The option "TickLength" controls the tick lengths:

BulletGauge[{42, 82}, {40, 68, 97}, {0, 100}, 
   "GaugeOrigin" -> #, "TickLength" -> Scaled[.3], ImageSize -> Medium] & /@
 {Bottom,  Top, Left, Right} // Row[#, Spacer[10]] &

enter image description here

Original answer:

You can post-process a BulletGauge to make it vertical:

bg = BulletGauge[{42, 82}, {40, 68, 97}, {0, 100}]

enter image description here

makeVertical = Graphics[GeometricTransformation[#[[1]], RotationTransform[Pi/2]] /.
  Text[a___, Offset[o_, p_], off_, dir_] :> 
   Text[a, Offset[{0, -20}, p], {1, 0}, -Reverse @ dir]] &;

makeVertical @ bg

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896
  • thank you very much. One question and one reflexion. The question How to control the sixe of segments between graph and Numbers?. https://imgur.com/a/G4Wji The reflexion: People with your Mathemtica knowledge or similar can do that kind of things, but I couln´t do it. So I can´t understand why Mathematica can´t offer that feature in a simple way. The purpose of a software should be make easier assignments/works and not offer a close-up solution that need a sophisticated procedure to can apply it. – Mika Ike Jan 07 '18 at 10:41
  • If I can make a HORIZONTAL bullet gauge in a minute. Logically, I would can make a VERTICAL bullet gauge in the same time, if the software it´s designed with a minimal logic. Without your help or other, I need months to reach the solution to make a VERTICAL bullet gauge, when I can do an HORIZONTAL bullet in less than 1 minute. It´s that what I can´t underestand in the design of Mathematica. – Mika Ike Jan 07 '18 at 10:45
  • 1
    @MikaIke, Thank you for the accept. I too am surprised that such a natural feature is not available out of the box. I will post an update with the parameters that control the tick lengths. – kglr Jan 07 '18 at 10:57
  • THANK YOU. INCREDIBLE!!! answer :-) undocumented option!!! "GaugeOrigin" ->Bottom EXCELENT!! Now I can´t understand why this is an undocumented option! :-) but you have solve many of my question. This is a graph that I like very much. It concentrate so many info! – Mika Ike Jan 07 '18 at 15:16
  • I can´t believe what you have written!! :-) but It´s really true!!!, IT works fine!!! excelent!!! but... I can´t view that option when I execute Options[BulletGauge] in Win 8 + Mathematica 11 :-) https://imgur.com/a/XyS9b You´re a hackker!! :-) a fantastic hacker! ;-) thank you, once more. – Mika Ike Jan 07 '18 at 18:44
  • 1
    @MikaIke, the option "GaugeOrigin" appears in Options[Charting`iLinearGauge] where Charting`iLinearGauge is one of the functions called by BulletGauge. – kglr Jan 07 '18 at 20:17
  • THANK YOU!Excuse for trying to understand how you achieve that info. 3 Questions: Q1.- How have you known that BulletGauge calls ChartingiLinearGauge (I have never viewed the apostroph in Functions and I can´t view it in Options https://imgur.com/a/XyS9b ). I can´t see it in Options[GaugeBullet] I cna´t see neitherCharting nor iLinearGaue Q2.- How have you known that Bottom, Top, Left, Right are the options for the GaugeOrigin. Q3.- Why GaugeOrigin apears in red (as using semicolon " " as using nothing) although working fine? https://imgur.com/a/DOAk1 in the opposite of ImageSize . – Mika Ike Jan 08 '18 at 06:54
  • 1
    @MikaIke, re (Q1) for some functions you can see the code using Needs["GeneralUtilities`"] followed by PrintDefinitions[BulletGauge]. There you see the call to Charting`iLinearGauge. (Q2) Based on BarOrigin for Histogram/BarChart it was a lucky guess that Left/Right/Top/Bottom might work:) (Q3) Red highlight indicates syntax error which i guess is related to the fact that this usage pattern is undocumented and syntax highlighting subsystem treats it as error. – kglr Jan 08 '18 at 07:22
0

I think using Rotate is pretty "out of the box" solution (although the tick labels are not rotated.)

bg = BulletGauge[{42, 82}, {40, 68, 97}, {0, 100}];
Rotate[bg, Pi/2]

enter image description here

Anton Antonov
  • 37,787
  • 3
  • 100
  • 178