3
$\begingroup$

I am having a very strange problem. I made a very long code in Mathematica 10.4, the same notebook is not running properly in version 11. I figured out few problems myself.My code has an automatic way of labeling the plot. It used to work fine but now it shows Rowbox[.... etc in the plot. I am not able to understand what had happened in the new versions that creates that problem. Please guide me in this. Following is the command I use to create frame label.

parametersNV := HoldForm[Sequence[R = 2.5, α = 1.5, Pr = 4.5, Subscript[θ, w] = 1.8, Rd = 0.2]]; ReleaseHold[parametersNV];

this is needed for input to the label the command for label is

framelbl := {{"θ(ζ)",Rotate["", 180 Degree]}, {"ζ", StringReplace[ToString[parametersNV, StandardForm],"HoldForm[" | "]" -> ""]}} 

The difference between he outputs in versions 10.4 and 11 is shown in the picture below enter image description here Please guide me to get rid of this error.

A simplified test code is as follows. I had to cut down a lot of things so it may not look very elegant, sorry for that.

Remove["Global`*"];
SetOptions[EvaluationNotebook[], CellEpilog :> SelectionMove[EvaluationNotebook[], Next, Cell]]
styleoptn = List[List[Black, Dashing[None], Thickness[0.005]],{Black, Dashing[Small], Thickness[0.005]},{Black, Dashing[Medium], Thickness[0.005]},{Black, Dashing[Large], Thickness[0.005]}];
xlb := -1;
xub := 1;
numcurves := 4;
parametersNV := HoldForm[Sequence[R = 2.5, Rd = 1.2,Subscript[θ, w] = 1.8]]; ReleaseHold[parametersNV];
framelbl := {{"θ(ζ)",Rotate["", 180 Degree]}, {"ζ", StringReplace[ToString[parametersNV, StandardForm],"HoldForm[" | "]" -> ""]}}
paramterV := {A};       
parvarying := List[0.0, 0.1, 0.2, 0.3];
parvaryingname := {"A= ``"}
curves := Evaluate@Table[d[i], {i, 1, numcurves}]
ftns := Table[v[parvarying[[i]], x], {i, 1, numcurves}];
v[A_, x_] := x^4 + A  x^3 + 3 Rd x^2 + 5  Subscript[θ, w]
Table[d[i] := Evaluate[ ftns[[i]]], {i, 1, numcurves}];
imgsz = 400;
plotleg := {Placed[
LineLegend[Automatic, 
 Table[Style[
   StringReplace[
    ToString@
     NumberForm[StringForm[parvaryingname[[1]], parvarying[[i]]], 
      ExponentFunction -> (Null &)], 
    RegularExpression["\\.$"] -> ".0"], "Arial", 12], {i, 1, 
   numcurves}], LegendLayout -> "Column", 
 LegendFunction -> "Frame", LegendMarkerSize -> {{30, 3}}], {0.7, 
 0.6}]};
Plot[{curves[[1]], curves[[2]], curves[[3]], curves[[4]]}, {x, xlb,xub}, PlotStyle -> styleoptn, ImageSize -> imgsz, Frame -> True,Axes -> False,FrameLabel -> framelbl, RotateLabel -> True,LabelStyle -> Black,PlotLegends -> plotleg,FrameStyle -> Directive["Arial", 16]]

I again apologize for the ugly look of the code; I dont know how to split it in to cells here. The code works perfectly fine in 10.0.2. I just copy-pasted the above code in a new notebook. Please see the screenshot enter image description here

@Mr.Wizard! The output is as follows

"\!\(\*RowBox[{\"HoldForm\", \"[\", RowBox[{RowBox[{\"R\", \"=\", \"2.5`\"}], \",\", RowBox[{\"Rd\", \"=\", \"1.2`\"}], \",\",RowBox[{SubscriptBox[\"\[Theta]\", \"w\"], \"=\", \\"1.8`\"}]}], \"]\"}]\)"
$\endgroup$
  • $\begingroup$ Would you kindly post your program that automatically labels the plot, along with a sample plot that uses it? Thanks. $\endgroup$ – QuantumDot Aug 25 '16 at 8:07
  • $\begingroup$ it is posted now $\endgroup$ – naveed Aug 25 '16 at 12:20
  • $\begingroup$ Can you use parametersNV := "R=2.5,Rd=1.2,\*SubscriptBox[\[Theta],w]=1.8" instead of what you have? $\endgroup$ – QuantumDot Aug 25 '16 at 12:24
  • $\begingroup$ I need their values too. For label they are supposed to behave like strings but for calculations we do need their values. And these values are supposed to be typed only once. $\endgroup$ – naveed Aug 25 '16 at 12:27
  • $\begingroup$ Naveed and @Szabolcs, I found that Mathematica 10.3, 10.4 and 11 generate the RowBox structures instead of the intended label. You have to go as far back as Mathematica 9 to see it rendered properly. $\endgroup$ – QuantumDot Aug 25 '16 at 15:21
1
$\begingroup$

How about

parametersNV = HoldForm[{R = 2.5, α = 1.5, Pr = 4.5, Subscript[θ, w] = 1.8, Rd = 0.2}];
ReleaseHold[parametersNV];

framelbl = {{"θ(ζ)", Rotate["", 180 Degree]}, {"ζ", Row[Thread@parametersNV, ","]}};

Graphics[{}, Frame -> True, FrameLabel -> framelbl, LabelStyle -> 14]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you. It works perfectly fine for the moment :). Thank you everyone for your efforts and help. $\endgroup$ – naveed Aug 27 '16 at 9:06

Your Answer

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

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