0
$\begingroup$

I have attached a picture of a graph which I obtained by combining three plots obtained named them plot1, plot2 and plot3. I have used the following code for combining these plots:

Show[plot1, plot2, plot3, PlotRange -> Automatic, Frame -> {{True, True}, {True, True}}, 
FrameLabel -> {Style["Number of iterates", Black, Small],Style["Absolute error", Black, Small]}, 
Epilog ->Inset[LineLegend[{Red, Cyan, Black}, {"New", "Newton","Modified  Newton"}], {8, 0.020}]]

I have obtained the following image enter image description here

Now I want to enlarge manually or automatically New, Newton and Modified newton inside the image. Also the lines with New, Newton and Modified newton are straight and smoth. I want to make them according to the dashes as the plotted lines.

$\endgroup$
2
  • $\begingroup$ LineLegend[{Red, Cyan, Black}, Style[#, 16] & /@ {"New", "Newton", "Modified Newton"}]. Not sure what you mean by "I want to make them according to the dashes as the plotted lines". $\endgroup$ Mar 11, 2022 at 18:48
  • 1
    $\begingroup$ @RohitNamjoshi I think that the idea here is to have matching PlotStyle between each curve and its associated LineLegend $\endgroup$
    – user49048
    Mar 11, 2022 at 23:00

1 Answer 1

1
$\begingroup$

Since you did not provide code for the plots explicitly I chose to plot some toy functions.

frame[xx_] := Framed[xx, FrameStyle -> {Black, Thickness[.1]}];
Plot[{x, x^2, x^3}, {x, 0, 5}, PlotRange -> {{0, 5}, {0, 5}}, 
 PlotStyle -> {{Red, AbsoluteThickness[3]}, {Cyan, Dashed, 
    AbsoluteThickness[3]}, {Dashing[Tiny], Thickness[.01], Black}}, 
 Frame -> {{True, True}, {True, True}}, 
 FrameLabel -> {Style["Number of iterates", Black, Small], 
   Style["Absolute error", Black, Small]}, 
 PlotLegends -> 
  Placed[
   LineLegend[{Style["New", 17], Style["Newton", 17], 
     Style["Modified Newton", 17]}, LegendFunction -> frame], {.8, 
    0.5}], ImageSize -> 700]

plot

Edit: another -equivalent- way of writing the above is the following:

Plot[{x, x^2, x^3}, {x, 0, 5}, PlotRange -> {{0, 5}, {0, 5}}, 
 PlotStyle -> {{Red, AbsoluteThickness[3]}, {Cyan, Dashed, 
    AbsoluteThickness[3]}, {Dashing[Tiny], Thickness[.01], Black}}, 
 Frame -> {{True, True}, {True, True}}, 
 FrameLabel -> {Style["Number of iterates", Black, Small], 
   Style["Absolute error", Black, Small]}, 
 PlotLegends -> 
  Placed[LineLegend[{Style["New", 17], Style["Newton", 17], 
     Style["Modified Newton", 17]}, 
    LegendFunction -> (Framed[#, 
        FrameStyle -> {Black, Thickness[.1]}] &)], {.8, 0.5}], 
 ImageSize -> 700]

If you do not wish the LineLegend to be framed just remove the following from the above commands:

LegendFunction -> frame

or

LegendFunction -> (Framed[#, FrameStyle -> {Black, Thickness[.1]}] &)

depending if you like the former or the latter better.

$\endgroup$

Your Answer

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

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