I tried to save the plot P1 by right clicking on the plot and pressing save as. I found that the PlotLegend is not saved. Please help.

 P1 = Plot[{Sin[ t], Cos[ t], Tan[ t]}, {t, 0, 10}, 
  PlotStyle -> {{Blue, Dashing[None], Thickness[0.005]}, {Red, 
     Dashing[Tiny], Thickness[0.005]}, {Green, Dashing[Small], 
     Thickness[0.005]}}, Axes -> False, Frame -> True, 
  PlotLegends -> 
   Placed[LineLegend[Automatic, {"sin", "cos", "tan for b=1"}, 
     LegendMarkerSize -> {{20, 10}}], Top]]
  • 1
    $\begingroup$ See the documentation for ParametricNDSolve. $\endgroup$ – bbgodfrey May 27 '17 at 15:48

A density plot can be obtained by deleting PC = 20.0 from the first line of code and replacing NDSolve by

solPC = ParametricNDSolve[          
    Join[system, initialvalues], {Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, 
    Y10, Y11, Y12, Y13, Y14, Y15, Y16, Y17, Y18, Y19, Y20, Y21, Y22, 
    Y23, Y24, Y25, Y26, Y27}, {t, 0, 15}, {PC}, MaxSteps -> Infinity];

Re[Y7} then can be plotted for larger values of PC by

Plot[Evaluate[Table[Re[(Y7 /. solPC)[pc][t]], {pc, 16, 20}]], {t, 0, 15}, 
    AxesLabel -> {"t", "Y7"}]

enter image description here

The corresponding density plot is

Table[Evaluate[Re[( Y7 /. solPC)[pc][t]]], {pc, 16, 20, .5}, {t, 0, 15, .25}];
ListDensityPlot[%, DataRange -> {{0, 15}, {16, 20}}, ColorFunction -> "Rainbow"]

enter image description here

For smaller values of PC, the numerical integration becomes unstable. Probably, this latter problem can be resolved by proper choices for ParametricNDSolve options.

| improve this answer | |

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.