Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Background color for plot area (not whole graphic) and white

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78313] Background color for plot area (not whole graphic) and white
  • From: Luci Ellis <luci at verbeia.com>
  • Date: Thu, 28 Jun 2007 04:23:06 -0400 (EDT)


Dear MathGroupers,



Is it possible to have a background colour for a plot that only affects the

area inside the frame? The normal Background option also colours the area

under the frame and axes numbers in the background colour, which is not what

I want. I can fake the effect by drawing a rectangle with the same

dimensions as the PlotRange (see example code below), but then white

gridlines on a grey background are impossible.



For reference, the kinds of graph styles I am trying to replicate are the

two (slightly different) styles shown in the following links. I would thus

also be grateful for suggestions on how to manipulate the tick length, and

how to get different left and right vertical scales on the same plot.



http://www.bis.org/publ/arpdf/ar2007e2.pdf

http://www.bis.org/publ/qtrpdf/r_qt0706a.pdf



Many thanks,

Luci Ellis



*** Mathematica example code ***





BISLineGraph[data : {{__Real} ..}, {rangemin_, rangemax_}, opts___Rule] /;

rangemin < rangemax && Length[data] < 9 :=



 

 With[{numseries = Length[data], numpoints = Dimensions[data][[2]], 



datamax = Max[Join @@ data], datamin = Min[Join @@ data]},



Show[{ListLinePlot[data, Frame -> True,  PlotRange -> {rangemin, rangemax},

    AxesOrigin -> {numpoints, 0},

    PlotStyle -> Table[Directive[{BISLineColours[[i]],

AbsoluteThickness[2]}], {i, numseries}],

    FrameTicks -> {Automatic, Automatic, None, Automatic}, 



    GridLinesStyle -> Directive[GrayLevel[0.9], AbsoluteThickness[1]], 



    GridLines -> {None, Automatic}, 



    FrameStyle -> Directive[FontFamily -> "Arial", FontSize -> 11] , 



opts], Graphics[{GrayLevel[0.2], Opacity[0.1],  Rectangle[{-0.5, rangemin},

{numpoints + .5, rangemax }]} ]} ]]



Where BISLineColours is a list of RGBColor directives.






  • Prev by Date: Aligning Plots in V6
  • Next by Date: Re: Mathematica code for survival functions
  • Previous by thread: Re: Aligning Plots in V6
  • Next by thread: Quick and dirty Zooming tool