<div dir="ltr"><div dir="ltr">On Fri, Apr 14, 2023 at 2:58 AM Smit Thijs <<a href="mailto:thijs.smit@hest.ethz.ch">thijs.smit@hest.ethz.ch</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg6743696256991129877">
<div lang="EN-GB" style="overflow-wrap: break-word;">
<div class="m_6743696256991129877WordSection1">
<p class="MsoNormal">Hi All,<u></u><u></u></p>
<p class="MsoNormal"><br>
I am trying to plot a loglog plot with two lines, one for my error and one with a slope of 1. Plotting only the error or only the slope of 1 works fine, but I like both lines in the same plot (that doesn’t work till now). Does somebody know how to solve this?
Find a code snipet below: <br>
<br>
<u></u><u></u></p>
<p class="MsoNormal">PetscDraw draw;<u></u><u></u></p>
<p class="MsoNormal">PetscDrawLG lg;<u></u><u></u></p>
<p class="MsoNormal">PetscDrawAxis axis;<u></u><u></u></p>
<p class="MsoNormal">PetscReal xc, yc;<u></u><u></u></p>
<p class="MsoNormal">PetscDrawCreate(PETSC_COMM_SELF, NULL, "Log(Error) vs Log(dx)", PETSC_DECIDE, PETSC_DECIDE, PETSC_DRAW_HALF_SIZE, PETSC_DRAW_HALF_SIZE, &draw);<u></u><u></u></p>
<p class="MsoNormal">PetscDrawSetFromOptions(draw);<u></u><u></u></p>
<p class="MsoNormal">PetscDrawLGCreate(draw, <span style="background:yellow">
2</span>, &lg);<u></u><u></u></p>
<p class="MsoNormal">PetscDrawLGSetUseMarkers(lg, PETSC_TRUE);<u></u><u></u></p>
<p class="MsoNormal">PetscDrawLGGetAxis(lg, &axis);<u></u><u></u></p>
<p class="MsoNormal">PetscDrawAxisSetLabels(axis, NULL, "Log(dx)", "Log(Error)");<br>
<br>
for loop {<u></u><u></u></p>
<p class="MsoNormal">xc = PetscLog10Real(dx);<u></u><u></u></p>
<p class="MsoNormal">yc = PetscLog10Real(error);<u></u><u></u></p>
<p class="MsoNormal">PetscDrawLGAddPoint(lg, &xc, &yc); // to plot the error</p></div></div></div></blockquote><div><br></div><div>Here is want an array of points, one for each curve:</div><div><br></div><div> <a href="https://petsc.org/main/manualpages/Draw/PetscDrawLGAddPoint/">https://petsc.org/main/manualpages/Draw/PetscDrawLGAddPoint/</a></div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg6743696256991129877"><div lang="EN-GB" style="overflow-wrap: break-word;"><div class="m_6743696256991129877WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><span style="background:yellow">PetscDrawLGAddPoint(lg, &xc, &xc); // to plot line with slope 1</span><u></u><u></u></p>
<p class="MsoNormal">PetscDrawLGDraw(lg);<br>
}<br>
<br>
<u></u><u></u></p>
<p class="MsoNormal">PetscDrawSetPause(draw, -2);<u></u><u></u></p>
<p class="MsoNormal">PetscDrawLGDestroy(&lg);<u></u><u></u></p>
<p class="MsoNormal">PetscDrawDestroy(&draw);<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="color:rgb(36,41,46)">Best regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(36,41,46)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(36,41,46)">Thijs Smit<u></u><u></u></span></p>
</div>
</div>
</div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>