Skip to main content
added 513 characters in body
Source Link
Szabolcs
  • 235.8k
  • 31
  • 627
  • 1.3k

This option is not relevant since version 6 of Mathematica.

Before version 6, graphics did not display immediately after evauating the (inert) Graphics[] expression. They could be shown using the Show command (it was a side-effect of Show). (This is the reason why the function which today is used to combine graphics has such an unusual name---Show.)

So building graphics went like this:

g = Graphics[ ... ]

(* the output of this would be formatted simply as the string --Graphics-- *)

Show[g]

(* now the graphics was displayed *)

Show displayed the graphics by evaluating its display function. Plotting functions (such as Plot) called Show automatically.

In version 6, any Graphics object is formatted by the front end as the image it represents (instead of the placeholder --Graphics--). Running the DisplayFunction is no longer needed (at least when using the standard notebook interface). But the mechanism is still in place, and we can try it out:

g = Graphics[Circle[], DisplayFunction -> CreateDialog]

(* this is shown the usual way---remember, the front end formats
   any Graphics expression as the "image"/drawing it represents *)

Show[g]

(* now CreateDialog is evaluated and a window with the graphics pops up *)

With the default version 8 DisplayFunction, which is Identity, Show would have returned the original graphics, as applying Identity to something just returns it as it is.

I hope this explains the purpose of DisplayFunction.


Edit:

There are still a number of display mechanisms that use DisplayFunction. One is <<Version5`Graphics` mentioned by @Mr.Wizard. You can find some others by checking the files in $InstallationDirectory/SystemFiles/Kernel/Packages, and the readme file there. The available options depend on the operating system. On Windows, you can try for example, <<Terminal` and <<JavaGraphics` (try both when running the kernel in command line mode, and don't forget to use Show).

This option is not relevant since version 6 of Mathematica.

Before version 6, graphics did not display immediately after evauating the (inert) Graphics[] expression. They could be shown using the Show command (it was a side-effect of Show). (This is the reason why the function which today is used to combine graphics has such an unusual name---Show.)

So building graphics went like this:

g = Graphics[ ... ]

(* the output of this would be formatted simply as the string --Graphics-- *)

Show[g]

(* now the graphics was displayed *)

Show displayed the graphics by evaluating its display function.

In version 6, any Graphics object is formatted by the front end as the image it represents (instead of the placeholder --Graphics--). Running the DisplayFunction is no longer needed (at least when using the standard notebook interface). But the mechanism is still in place, and we can try it out:

g = Graphics[Circle[], DisplayFunction -> CreateDialog]

(* this is shown the usual way---remember, the front end formats
   any Graphics expression as the "image"/drawing it represents *)

Show[g]

(* now CreateDialog is evaluated and a window with the graphics pops up *)

With the default version 8 DisplayFunction, which is Identity, Show would have returned the original graphics, as applying Identity to something just returns it as it is.

I hope this explains the purpose of DisplayFunction.

This option is not relevant since version 6 of Mathematica.

Before version 6, graphics did not display immediately after evauating the (inert) Graphics[] expression. They could be shown using the Show command (it was a side-effect of Show). (This is the reason why the function which today is used to combine graphics has such an unusual name---Show.)

So building graphics went like this:

g = Graphics[ ... ]

(* the output of this would be formatted simply as the string --Graphics-- *)

Show[g]

(* now the graphics was displayed *)

Show displayed the graphics by evaluating its display function. Plotting functions (such as Plot) called Show automatically.

In version 6, any Graphics object is formatted by the front end as the image it represents (instead of the placeholder --Graphics--). Running the DisplayFunction is no longer needed (at least when using the standard notebook interface). But the mechanism is still in place, and we can try it out:

g = Graphics[Circle[], DisplayFunction -> CreateDialog]

(* this is shown the usual way---remember, the front end formats
   any Graphics expression as the "image"/drawing it represents *)

Show[g]

(* now CreateDialog is evaluated and a window with the graphics pops up *)

With the default version 8 DisplayFunction, which is Identity, Show would have returned the original graphics, as applying Identity to something just returns it as it is.

I hope this explains the purpose of DisplayFunction.


Edit:

There are still a number of display mechanisms that use DisplayFunction. One is <<Version5`Graphics` mentioned by @Mr.Wizard. You can find some others by checking the files in $InstallationDirectory/SystemFiles/Kernel/Packages, and the readme file there. The available options depend on the operating system. On Windows, you can try for example, <<Terminal` and <<JavaGraphics` (try both when running the kernel in command line mode, and don't forget to use Show).

Source Link
Szabolcs
  • 235.8k
  • 31
  • 627
  • 1.3k

This option is not relevant since version 6 of Mathematica.

Before version 6, graphics did not display immediately after evauating the (inert) Graphics[] expression. They could be shown using the Show command (it was a side-effect of Show). (This is the reason why the function which today is used to combine graphics has such an unusual name---Show.)

So building graphics went like this:

g = Graphics[ ... ]

(* the output of this would be formatted simply as the string --Graphics-- *)

Show[g]

(* now the graphics was displayed *)

Show displayed the graphics by evaluating its display function.

In version 6, any Graphics object is formatted by the front end as the image it represents (instead of the placeholder --Graphics--). Running the DisplayFunction is no longer needed (at least when using the standard notebook interface). But the mechanism is still in place, and we can try it out:

g = Graphics[Circle[], DisplayFunction -> CreateDialog]

(* this is shown the usual way---remember, the front end formats
   any Graphics expression as the "image"/drawing it represents *)

Show[g]

(* now CreateDialog is evaluated and a window with the graphics pops up *)

With the default version 8 DisplayFunction, which is Identity, Show would have returned the original graphics, as applying Identity to something just returns it as it is.

I hope this explains the purpose of DisplayFunction.