1
$\begingroup$

I want to save multiple images, each with an appropriately assigned name, in my working directory. The images show inverse trigonometric function plots listed below:

$InverseTrigFunctions = {ArcSin, ArcCos, ArcSec, ArcCsc, ArcTan, ArcCot, ArcSinh, ArcCosh, ArcSech, ArcCsch, ArcTanh, ArcCoth}

Table[DensityPlot[Im[f[(x + I y)^3]], {x, -2, 2}, {y, -2, 2}, ColorFunction -> "Pastel", ExclusionsStyle -> {None, Purple}, Mesh -> None, PlotLabel -> Im[f[(x + I y)^3]], Ticks -> None], {f, $InverseTrigFunctions}]

I use the Export function but I cannot save the images using a single command to my working directory.

How I can do this? Using a loop?

$\endgroup$

1 Answer 1

1
$\begingroup$

Just use Export, ToString and string concatenation:

inverseTrigFunctions = {ArcSin, ArcCos, ArcSec, ArcCsc, ArcTan, 
   ArcCot, ArcSinh, ArcCosh, ArcSech, ArcCsch, ArcTanh, ArcCoth};

Table[Export[ToString[f] <> "-plot.png", 
  DensityPlot[Im[f[(x + I y)^3]], {x, -2, 2}, {y, -2, 2}, 
   ColorFunction -> "Pastel", ExclusionsStyle -> {None, Purple}, 
   Mesh -> None, PlotLabel -> Im[f[(x + I y)^3]], Ticks -> None]], {f,
   inverseTrigFunctions}]

This exports them to files with the function name first, "-plot.png" for the rest of the name.

$\endgroup$
1
  • $\begingroup$ thanks a lot for these tips @Kirma $\endgroup$ Commented May 4, 2022 at 16:37

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.