This is really easy in Matlab but I am having a hard time to find an equivalent in Mathematica. I am simply trying to create a convergence plot that I want to add one point in every time step, of course, I don't want to keep redrawing the plot since I might end up having 100000 points in there. I found a solution to have the plot in a separate window but not able stop redrawing it.
BeginPackage["Plotsprt`"];
MainPlotsprt::usage=" ";
Begin["`Private`"];
MainPlotsprt[dt_, conver_,tfinal_]:= Module[{},
obj=CreateDocument[Dynamic[theGraphic],WindowSize->{500,500}];
$DisplayFunction=((CreateDocument[#,obj];#)&);
Do[
conver=conver-0.0000001;
theGraphic=ListPlot[{{dt*i,Log10[conver]}},PlotRange->All],
{i,tfinal}]
Return[];
];
SetAttributes[MainPlotsprt,{HoldAll}]
End[];
EndPackage[];
(* Get[FileNameJoin[{NotebookDirectory[], "Plotsprt.wl"}]]; *)
dt = 0.1;
conver = 0.001;
tfinal = 500;
Plotsprt`MainPlotsprt[dt, conver, tfinal]
theGraphicat each interation. Createdataand once you want to show changes usetheGraphic = ListPlot[data, ...]. Is this what you want?> – Kuba Apr 23 '18 at 08:21datatable and each 100 steps you need to updatetheGraphics. – Kuba Apr 23 '18 at 08:43