Skip to main content
added 265 characters in body
Source Link
Vitaliy Kaurov
  • 73.4k
  • 9
  • 205
  • 358

==== EDIT: Applications/Usability - after @Jens comment ====

@Jens is right in his comment that this could be useful - thanks for bringing it up. You can define a function just once and then automate its application via global

SetOptions[Plot, DisplayFunction-> myFunctiom]

Now let see how it works.

===============================================================

In addition to the useful answers given, to figure out how things work, you can do a little experimenting of your own. First produce some usual plot

p=Plot[Sin[4 x]/x, {x, -9, 9}, Filling -> 0]

enter image description here

And check its options which will reveal the default setting for DisplayFunction

Options[p]
{AspectRatio -> 1/GoldenRatio, Axes -> True, 
 AxesOrigin -> {0, 0}, DisplayFunction :> Identity, 
 PlotRange -> {{-9, 9}, {-0.868934, 0.863343}}, 
 PlotRangeClipping -> True, 
 PlotRangePadding -> {Scaled[0.02], Scaled[0.02]}}

Now try experimenting:

Plot[Sin[x], {x, -6.6, 6.6}, DisplayFunction -> MyTestFunction]

enter image description here

So you see it just wraps around. So you can now do things like

DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, 
 ColorFunction -> "SunsetColors", Frame -> False, 
 DisplayFunction -> (GraphicsGrid[ImagePartition[#, 20]] &)]

enter image description here

Which you of course could do just simply wrapping you custom function around your plot in the first place, unless you want to automate your actions as explained in the beginning of the post.

In addition to the useful answers given, to figure out how things work, you can do a little experimenting of your own. First produce some usual plot

p=Plot[Sin[4 x]/x, {x, -9, 9}, Filling -> 0]

enter image description here

And check its options which will reveal the default setting for DisplayFunction

Options[p]
{AspectRatio -> 1/GoldenRatio, Axes -> True, 
 AxesOrigin -> {0, 0}, DisplayFunction :> Identity, 
 PlotRange -> {{-9, 9}, {-0.868934, 0.863343}}, 
 PlotRangeClipping -> True, 
 PlotRangePadding -> {Scaled[0.02], Scaled[0.02]}}

Now try experimenting:

Plot[Sin[x], {x, -6.6, 6.6}, DisplayFunction -> MyTestFunction]

enter image description here

So you see it just wraps around. So you can now do things like

DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, 
 ColorFunction -> "SunsetColors", Frame -> False, 
 DisplayFunction -> (GraphicsGrid[ImagePartition[#, 20]] &)]

enter image description here

Which you of course could do just simply wrapping you custom function around your plot in the first place.

==== EDIT: Applications/Usability - after @Jens comment ====

@Jens is right in his comment that this could be useful - thanks for bringing it up. You can define a function just once and then automate its application via global

SetOptions[Plot, DisplayFunction-> myFunctiom]

Now let see how it works.

===============================================================

In addition to the useful answers given, to figure out how things work, you can do a little experimenting of your own. First produce some usual plot

p=Plot[Sin[4 x]/x, {x, -9, 9}, Filling -> 0]

enter image description here

And check its options which will reveal the default setting for DisplayFunction

Options[p]
{AspectRatio -> 1/GoldenRatio, Axes -> True, 
 AxesOrigin -> {0, 0}, DisplayFunction :> Identity, 
 PlotRange -> {{-9, 9}, {-0.868934, 0.863343}}, 
 PlotRangeClipping -> True, 
 PlotRangePadding -> {Scaled[0.02], Scaled[0.02]}}

Now try experimenting:

Plot[Sin[x], {x, -6.6, 6.6}, DisplayFunction -> MyTestFunction]

enter image description here

So you see it just wraps around. So you can now do things like

DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, 
 ColorFunction -> "SunsetColors", Frame -> False, 
 DisplayFunction -> (GraphicsGrid[ImagePartition[#, 20]] &)]

enter image description here

Which you of course could do just simply wrapping you custom function around your plot in the first place, unless you want to automate your actions as explained in the beginning of the post.

Source Link
Vitaliy Kaurov
  • 73.4k
  • 9
  • 205
  • 358

In addition to the useful answers given, to figure out how things work, you can do a little experimenting of your own. First produce some usual plot

p=Plot[Sin[4 x]/x, {x, -9, 9}, Filling -> 0]

enter image description here

And check its options which will reveal the default setting for DisplayFunction

Options[p]
{AspectRatio -> 1/GoldenRatio, Axes -> True, 
 AxesOrigin -> {0, 0}, DisplayFunction :> Identity, 
 PlotRange -> {{-9, 9}, {-0.868934, 0.863343}}, 
 PlotRangeClipping -> True, 
 PlotRangePadding -> {Scaled[0.02], Scaled[0.02]}}

Now try experimenting:

Plot[Sin[x], {x, -6.6, 6.6}, DisplayFunction -> MyTestFunction]

enter image description here

So you see it just wraps around. So you can now do things like

DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, 
 ColorFunction -> "SunsetColors", Frame -> False, 
 DisplayFunction -> (GraphicsGrid[ImagePartition[#, 20]] &)]

enter image description here

Which you of course could do just simply wrapping you custom function around your plot in the first place.