3
$\begingroup$

I use sometimes the HorizontalGauge instead of a slider in Manipulateor instead of the ProgressIndicator. I find it very convenient, since it gives quantitative information on the status of the calculation. During performing the calculation it looks as it is expected: enter image description here

However, when I close a notebook and then open it once more, it looks as follows:

enter image description here

Which is, generally, ugly.

Is there a way to preserve its form, so that it has the former performance also after closing/opening of the notebook?

Edit: To address the question of Kuba, a simplistic code with the described behavior is given below. It shows the use of the HorizontalGauge instead of the ProgressIndicatorto monitor the solution of a differential equation:

    Clear[x, y, data, k];
data = {{0, 1}};
k = 0;
HorizontalGauge[Dynamic[k], {0, 30}]
Dynamic[ListPlot[data, Frame -> True, 
  PlotRange -> {{0, 31}, {0, 1.2}}]]
NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}, 
  StepMonitor :> (Pause[.02]; Set[k, x]; AppendTo[data, {x, y[x]}])];

On the screen one should see the following:

enter image description here

The HorizontalGaugehere shows the state of the solution of the differential equation. After evaluation it has the canonical appearance. However, after closing/opening of the notebook its appearance changes.

Another example is the use of the gauge in Manipulate:

 Manipulate[
 Plot[Sin[a x], {x, 0, 4 Pi}], {{a, 1}, 0, 6.28, 
  VerticalGauge[##, ImageSize -> 50] &}, ControlPlacement -> Left]

enter image description here

Here in contrast to the previous case the VerticalGauge preserves its appearance even after closing/opening of the notebook.

$\endgroup$
  • $\begingroup$ @Kuba Please see the edit. $\endgroup$ – Alexei Boulbitch Jan 21 '16 at 9:23
  • $\begingroup$ I see. When the plot is done I'm saving the nb and closing MMA, after reopening it looks ok, only plot doesn't due to the fact that data doesn't exist anymore. I'm on Win10 V10.3.1 $\endgroup$ – Kuba Jan 21 '16 at 9:25
  • $\begingroup$ @Kuba Yes, exactly. But my main concern is not the plot, but the appearance of the gauge. I gave one more example of the gauge use in Manipulate. There everything is OK, the appearance persists the closing/opening of the notebook. $\endgroup$ – Alexei Boulbitch Jan 21 '16 at 9:41
  • $\begingroup$ Yes, I know, my point was, the gauge looks ok in my case. $\endgroup$ – Kuba Jan 21 '16 at 9:42
  • $\begingroup$ @Kuba, Well I have Win7/Mma10.3 $\endgroup$ – Alexei Boulbitch Jan 21 '16 at 9:43

Your Answer

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

Browse other questions tagged or ask your own question.