MathGroup Archive 2011

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

Search the Archive

Re: color-bar legend for the LisContourPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123671] Re: color-bar legend for the LisContourPlot
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 15 Dec 2011 04:53:47 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jbspea$3mj$1@smc.vnet.net> <201112141100.GAA10135@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

That code fails with this error:

With::lvws: Variable legendW in local variable specification  
{zmin=-2,zmax=2,delz=0.5,datasize={10,10},plotW=300,plotH=300,legendW,ticklblW=30,ticklblH,grout=2,colorset=ArmyColors}  
requires a value. >>

Bobby

On Wed, 14 Dec 2011 05:00:36 -0600, Dan <dflatin at rcn.com> wrote:

> On Dec 9, 5:55 am, "Karamiarokhloo, M.P. (Mehdipasha)"
> <M.P.Karamiarokh... at uu.nl> wrote:
>> Dear All,
>>
>> I am using Mathematica 7 and have difficulties to plot the  
>> ListContourPlot
>> of ocean data with a neat color bar (legend).
>> For example if I have a temperature field range between {-2,30}, and I  
>> use
>> the ColorFunction Rainbow,
>> I cannot include a color-bar which has the same number of contours as  
>> the contourplot, and it does not show the related numbers for each  
>> color-shade.
>> The ShowLegend function of Mathematica is very primitive.
>> Has any body any suggestion?
>>
>> Thanks you.
>> P.Karami
>
> I like using Grid for this, and in general for constructing compound
> plots. For the legend, I use a trick I learned from David Park in this
> forum. Just make another contour plot. This gives you great control
> over choice and labeling of the contours. Here is a simple example
> where I have identified the various layout elements explicitly.
>
> With[{
>   zmin=-2,zmax=2,delz=0.5,datasize={10,10},
>   plotW=300,plotH=300,legendW,
>   ticklblW=30,ticklblH,grout=2,
>   colorset="ArmyColors"},
>
>   Module[{data,contours},
>     contours=Range[zmin,zmax,delz];
>     data=RandomReal[{zmin,zmax},datasize];
>
>     Grid[{{
>       ListContourPlot[data,InterpolationOrder->3,Contours->contours,
>         ImagePadding->{{ticklblW+grout,grout},{ticklblH+grout,grout}},
>         ImageSize->{plotW+ticklblW+2grout,plotH+ticklblH+2grout},
>         AspectRatio->plotH/plotW,
>         ColorFunction->colorset],
>       ContourPlot[y,{x,0,1},{y,zmin,zmax},Contours->contours,
>         ImagePadding->{{grout,ticklblW+grout},{ticklblH+grout,grout}},
>         ImageSize->{legendW+ticklblW+2grout,plotH+ticklblH+2grout},
>         AspectRatio->plotH/legendW,
>         FrameTicks->{{None,contours},{None,None}},
>         ColorFunction->colorset]
>     }}]
>   ]
> ]
>
> -- Dan
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: R: Plots come out blank except for certain limits
  • Next by Date: Re: NMinimize problem: fct minimized uses FindRoot
  • Previous by thread: Re: color-bar legend for the LisContourPlot
  • Next by thread: Re: color-bar legend for the LisContourPlot