1

Suppose I have the following plotting function:

selfPlot[func_]:=Show[ContourPlot[Re[f[x+I*y]],{x,-2,2},{y,-2,2}],ContourPlot[Im[f[x+I*y]],{x,-2,2},{y,-2,2}]]

How can I modify the function so that it can accept optional arguments like ContourStyle, AspectRatio that can be passed into the built-in ContourPlot?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Physicist
  • 987
  • 5
  • 14

1 Answers1

6

You can use a BlankNullSequence to deal with the options, just like this following code

selfPlot[f_, opts___] := 
 ContourPlot[{Re[f[x + I*y]], Im[f[x + I*y]]}, {x, -2, 2}, {y, -2, 2},
   opts]
selfPlot[#^2 Sin[#] &, ContourStyle -> {Red, Blue}]
wuyingddg
  • 1,943
  • 10
  • 14