MathGroup Archive 2008

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

Search the Archive

Re: Global setting of Graphics options for plot, listplot, listlogplot...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87068] Re: Global setting of Graphics options for plot, listplot, listlogplot...
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 31 Mar 2008 02:02:05 -0500 (EST)
  • References: <fsnb7i$d08$1@smc.vnet.net>

I would recommend against spending too much time trying to make a 'universal 
plot format'. You can certainly do it if you are producing repetitive plots 
of a specific type, say weather data plotted each day or a number of 
experimental data runs whose results were quite similar.

But the average technical person is going to have a range of graphics 
requirements. Each set of data or each mathematical idea will require its 
own style of presentation if the message is going to be conveyed with 
maximum effectiveness. What this come down to is that graphics is work if 
you really want to convey the clearest message and each graphic requires its 
individual treatment.

Nevertheless, there are things you can do for a number of similar plots. One 
approach is to create your own Show statement with the desired options:

MyShow[plot_] :=
 Show[plot,
  Frame -> True,
  GridLinesStyle -> GrayLevel[0.8],
  GridLines -> Automatic,
  BaseStyle -> {FontSize -> 12},
  ImageSize -> 450]

This works fairly well for simple linear scale plots.

MyShow[Plot[Sin[x], {x, 0, 6 \[Pi]}]]

data = Table[{x, x Cos[x]}, {x, 0, 6 \[Pi], 6 \[Pi]/100}];
MyShow[ListPlot[data]]

But not for Log plots because there the grid has to be generated within the 
Log plot.

MyShow[LogPlot[x!/(1 + x^2), {x, 0, 3}]]

So you could make a second Show statement that did not set the GridLines so 
you could inherit them from the Log plot.

MyLogShow[plot_] :=
 Show[plot,
  Frame -> True,
  GridLinesStyle -> GrayLevel[0.8],
  BaseStyle -> {FontSize -> 12},
  ImageSize -> 450]

MyLogShow[LogPlot[x!/(1 + x^2), {x, 0, 3}, GridLines -> Automatic]]

But then, do you really like Mathematics's choice of GridLines there?

So trying to create a universal plot format or style will only tend to 
divert you from the much more interesting issues that have to do with your 
individual plots and probably won't save you much time in the long run.

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


"zerosumgame" <rogerhw at hotmail.com> wrote in message 
news:fsnb7i$d08$1 at smc.vnet.net...
> Has anyone any experience (v6) with setting global graphics options.
> What I want to do is fairly simple.  I want all my graphics to have a
> frame, automatic gridlines of a particular colour and the same font
> etc.
>
> Fonts are easy, I can set those as in Option Inspector (Formatting
> Options/Expression Formatting/Graphics Box Options/GraphicsBoxOptions)
> in BaseStyle and DefaultBaseStyle.
>
> Setting Frame and GridLinesStyles here is not a good plan though as
> plot legends and graphics Grid use invisible graphics boxes to
> position things.  Adding frames and grids lines to all graphics boxes
> will corrupt these place holder boxes.
>
> I can, in my init.m file introduce altered values for Options[Plot]
> with Frame->True etc but I have to do this for Plot, ListPlot,
> LogPlot, ListLogPlot etc of which there are quite a few.
>
> Question is can anyone think of a better way?
>
> Thanks
>
> ZSG
> 



  • Prev by Date: Re: Mathlink: How do I pass arbitrary data from Mathematica to C?
  • Next by Date: Re: Separate input/output files
  • Previous by thread: Re: Global setting of Graphics options for plot, listplot, listlogplot...
  • Next by thread: Rotate axes label in 3D graphics