11
$\begingroup$

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.

$\endgroup$
2
  • 2
    $\begingroup$ 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. $\endgroup$
    – Kuba
    Jan 7, 2018 at 9:46
  • 1
    $\begingroup$ 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. $\endgroup$
    – C. E.
    Jan 7, 2018 at 11:34

2 Answers 2

16
$\begingroup$

"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

$\endgroup$
8
  • $\begingroup$ thank you very much. One question and one reflexion. The question How to control the sixe of segments between graph and Numbers?. 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. $\endgroup$
    – Mika Ike
    Jan 7, 2018 at 10:41
  • $\begingroup$ 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. $\endgroup$
    – Mika Ike
    Jan 7, 2018 at 10:45
  • 1
    $\begingroup$ @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. $\endgroup$
    – kglr
    Jan 7, 2018 at 10:57
  • 1
    $\begingroup$ @MikaIke, the option "GaugeOrigin" appears in Options[Charting`iLinearGauge] where Charting`iLinearGauge is one of the functions called by BulletGauge. $\endgroup$
    – kglr
    Jan 7, 2018 at 20:17
  • 1
    $\begingroup$ @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. $\endgroup$
    – kglr
    Jan 8, 2018 at 7:22
0
$\begingroup$

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

$\endgroup$
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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