Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I am trying to do:

I have been Mathematica user for a considerably short while. I have learned some of its functionality using wolfram how-to resources and the documentation. I am having difficulties constructing something similar as shown above.

I was wondering if anyone could give me pointers to resources that would allow me to achieve visuals as presented in the image attached with this question.

My objective is to use a slider to manipulate triangles height and as the slider moves text appears, color changes and values at milestones become visible.

Many thanks in advance!

share|improve this question
I have tried a couple of things. I tried to draw graphics and use ImageResize functionality together within Manipulate function. I have tried to plot it and then use slider to resize it in plot, but that failed as well. I think I know how to use Manipulate and If, however Graphics is something that I have never worked with before. @Kuba – user16187 Jun 27 '14 at 10:51
Something like: Manipulate[ Graphics[{{EdgeForm@Thick, FaceForm[], Polygon[{{0, 0}, {1, 1}, {-1, 1}}], FaceForm[Orange], Polygon[{{0, 0}, {a, a}, {-a, a}}]}}, PlotRange -> {0, 1}], {a, 0, 1}]? – Kuba Jun 27 '14 at 10:58
I have done something similar when trying to use Manipulate with Graphics. Your code looks much neater though. What I don't know how to do is how to dynamically change color and add this text when it reaches some height. I understand that it must be an If statement. I am not sure how to implement it. @Kuba – user16187 Jun 27 '14 at 11:04
Use FaceForm[Hue[a]] instead of FaceForm[Orange]. I mean, you must set the values you need but it is only a matter of writting it with If for example. – Kuba Jun 27 '14 at 11:06
Thank you for your help @Kuba. I really appreciate your time! I just need to get a hang of it. Will try to spend more time on it and see what I can make out of it! I find it rather difficult sometimes to write syntax in Mathematica as I am coming from C++ / Java / Python programming languages. – user16187 Jun 27 '14 at 11:15
up vote 2 down vote accepted

This is a rough idea you can build up on.

 Graphics[{Text[Text1, {-4, 1}], Text[Text2, {-4, 3}], 
   Text[Text3, {-4, 5}], 
   Text["10^-6", {4, 
     2}], {Line[{{1.5, 2}, {3.4, 2}}]}, {Line[{{2.5, 4}, {3.4, 4}}]}, 
   Text["10^-3", {4, 4}], {Green, 
    Polygon[{{{0, 0}, {-1, 2}, {1, 2}}}]}, {Orange, 
    Polygon[{{-1, 2}, {-2, 4}, {2, 4}, {1, 2}}]}, {Red, 
    Polygon[{{-2, 4}, {-3, 6}, {3, 6}, {2, 4}}]}, {EdgeForm[Thick], 
    Opacity[0], Rectangle[{-5.5, 0}, {5.5, 6.7}]}, {White, 
    Rectangle[{-6, a}, {6.5, 7.5}]}}, PlotRange -> {-1, 7}, 
  ImageSize -> 500], {{a, -1, "Slider"}, -1, 7}, 
 ControlType -> VerticalSlider, ControlPlacement -> Left]
share|improve this answer
this is brilliant thank you! – user16187 Jun 27 '14 at 14:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.