1

I use the following link in the forum to plot a graphic in a new windows. However when I use the code to create a new windows using the function described below in question, yes it works but in the new window I see only the results for the last file and not for each files I have (i.e. if I have 3 files, I have three new windows but with the result of the last file in my folder and not with the results of each file...). I would like to create a new windows graphic for each file I have...How to do that in my function ?

CreateDocument[Dynamic[secondDisplay]];
showOnSecond[expr_] := (secondDisplay = expr;);

showOnSecond@ListDensityPlot[...] 

Here the function I use :

file = FileNames["*.dat", NotebookDirectory[]];

func[file_String /; FileExistsQ[file]] := 
 Module[{data, dataT}, data = Import[file, "Table", HeaderLines -> 2];
  dataT = Transpose[data];
  dataT = {dataT[[1]]*10, dataT[[2]]*10, dataT[[3]]};
  dataT[[3]] = 
   Rescale[dataT[[3]], 
    MinMax[dataT[[3]]], {0, 1.}]; (*Rescale z between 0 to 1*) 
  data = Transpose[dataT];

CreateDocument[Dynamic[secondDisplay]];
    showOnSecond[expr_] := (secondDisplay = expr;);

showOnSecond@ListDensityPlot[data,
   ScalingFunctions -> {"Linear", "Linear", "Log10"},
   ImageSize -> UpTo[850],
   AspectRatio -> 1];

 ;
   ;
 ]

func /@ file
Bigprophete
  • 399
  • 1
  • 11

1 Answers1

1

As suggested from @Kuba, the following line works well :

CreateDocument@ListDensityPlot[data,
   ScalingFunctions -> {"Linear", "Linear", "Log10"},
   ImageSize -> UpTo[850],
   AspectRatio -> 1];
Bigprophete
  • 399
  • 1
  • 11