MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Setting global graphics options

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124945] Re: Setting global graphics options
  • From: "djmpark" <djmpark at comcast.net>
  • Date: Mon, 13 Feb 2012 03:42:17 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <32556127.9709.1329042100257.JavaMail.root@m06>

Themis,

You could put whatever code is needed in your init.m file.

The problem is that if you use a number of different plot types then you
would have to SetOptions for each one. It would be nicer to have a once and
for all definition that did not interfere with normal usage. To do this you
could use a private Show statement, say MShow, and put the options there. 

Also, plot options roughly fall into two categories: those that control the
production of the primitives for the drawn object (PlotStyle, Mesh,
PlotPoints, MaxRecursion, etc.) and those that control the overall look of
the graphic (ImageSize, Frame, BaseStyle, AspectRatio, etc.). PlotRange is
sometimes used in both places. I'm assuming that you are interested in the
second category of options.

I'll show how I would do it in the Presentations Application. There the 2D
Graphics statement is Draw2D. Draw2D can simply combine explicit primitives
and primitives produced by the various plot types. Suppose, just for
example, that your common special options are:

{ BaseStyle -> {FontSize -> 12}, Frame -> True, FrameLabel -> {"x", "f"},
ImageSize -> 300} 

Then you could add the following definition for your special MDraw2D command
to the Presentations init.m file:

Options[MDraw2D] = Options[Draw2D];
MDraw2D[{primitives__}, opts : OptionsPattern[]] := 
 Draw2D[{primitives}, opts, BaseStyle -> {FontSize -> 12}, 
  Frame -> True, FrameLabel -> {"x", "f"}, ImageSize -> 300] 

This builds in the special options and allows you to override or add extra
options if you wish. The following is an example of its use where we draw a
Sin function and use a Text primitive to label it. We also add two extra
options for the particular case.

MDraw2D[
 {Draw[Sin[x], {x, 0, 2 Pi}],
  Text["Sin Function", {2.5, Sin[2.5]}, {-1.2, 0}]},
 AspectRatio -> 0.3,
 PlotLabel -> "Using Automatic Options"
 ] 

I would like to add one extra comment. In general there is no
one-size-fits-all for graphics or "presentations of information".  Except in
repetitive cases such as daily weather charts or stock prices, each case has
special aspects or qualities and requires special treatment. Much time can
be consumed in trying to design general routines that ultimately fall short.
Better to think like an artist and enjoy doing and reworking the detail.
Edward Tufte writes in the Introduction to his "Visual Explanations": "Those
who discover an explanation are often those who construct its
representation." Think of graphics and presentations as part of the
scientific creative process and not just a chore to be completed before
publication.


David Park
djmpark at comcast.net 
http://home.comcast.net/~djmpark/index.html 


From: Themis Matsoukas [mailto:tmatsoukas at me.com] 


I have converged to a set of graphics options with respect to frames,
labels, fonts etc, that I use very often. How can I set up Mathematica to
load my options at launch time? I know I can use SetOptions but I would have
to execute this command each time I launch Mathematica. Is there a way to
set these options in the preferences somewhere? I looked  under
Format/Option Inspector but could not identify an appropriate option.

Thanks

Themis




  • Prev by Date: Re: Some assistance from seasoned users.
  • Next by Date: Re: List Manipulation
  • Previous by thread: Re: Setting global graphics options
  • Next by thread: Contributing dtSearch indexer plugin for Mathematica notebooks