Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7044 > unrolled thread

color-bar legend for the LisContourPlot

Started by"Karamiarokhloo, M.P. (Mehdipasha)" <M.P.Karamiarokhloo@uu.nl>
First post2011-12-09 10:55 +0000
Last post2011-12-15 09:59 +0000
Articles 7 — 4 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  color-bar legend for the LisContourPlot "Karamiarokhloo, M.P. (Mehdipasha)" <M.P.Karamiarokhloo@uu.nl> - 2011-12-09 10:55 +0000
    Re: color-bar legend for the LisContourPlot Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-12-10 12:32 +0000
    Re: color-bar legend for the LisContourPlot Dan <dflatin@rcn.com> - 2011-12-14 11:03 +0000
      Re: color-bar legend for the LisContourPlot Dan <dflatin@rcn.com> - 2011-12-15 09:54 +0000
        Re: color-bar legend for the LisContourPlot Dan <dflatin@rcn.com> - 2011-12-16 11:08 +0000
      Re: color-bar legend for the LisContourPlot DrMajorBob <btreat1@austin.rr.com> - 2011-12-16 10:57 +0000
    Re: color-bar legend for the LisContourPlot DrMajorBob <btreat1@austin.rr.com> - 2011-12-15 09:59 +0000

#7044 — color-bar legend for the LisContourPlot

From"Karamiarokhloo, M.P. (Mehdipasha)" <M.P.Karamiarokhloo@uu.nl>
Date2011-12-09 10:55 +0000
Subjectcolor-bar legend for the LisContourPlot
Message-ID<jbspea$3mj$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#7074

FromArmand Tamzarian <mike.honeychurch@gmail.com>
Date2011-12-10 12:32 +0000
Message-ID<jbvjgh$ivn$1@smc.vnet.net>
In reply to#7044
On Dec 9, 9:55 pm, "Karamiarokhloo, M.P. (Mehdipasha)"
<M.P.Karamiarokh...@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

Can you provide an example of what you are plotting?

Mike

[toc] | [prev] | [next] | [standalone]


#7196

FromDan <dflatin@rcn.com>
Date2011-12-14 11:03 +0000
Message-ID<jc9vqo$a0a$1@smc.vnet.net>
In reply to#7044
On Dec 9, 5:55 am, "Karamiarokhloo, M.P. (Mehdipasha)"
<M.P.Karamiarokh...@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

[toc] | [prev] | [next] | [standalone]


#7218

FromDan <dflatin@rcn.com>
Date2011-12-15 09:54 +0000
Message-ID<jccg47$mbp$1@smc.vnet.net>
In reply to#7196
On Dec 14, 6:03 am, Dan <dfla...@rcn.com> wrote:
> On Dec 9, 5:55 am, "Karamiarokhloo, M.P. (Mehdipasha)"
>
> <M.P.Karamiarokh...@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

Somehow some specific assignments went missing in this post. Since I
copied and pasted into the window I don't know how that could have
happened, but use:

legendW
ticklblH

to get the figure as I intended.

-- Dan

[toc] | [prev] | [next] | [standalone]


#7283

FromDan <dflatin@rcn.com>
Date2011-12-16 11:08 +0000
Message-ID<jcf8rb$728$1@smc.vnet.net>
In reply to#7218
On Dec 15, 4:54 am, Dan <dfla...@rcn.com> wrote:
> On Dec 14, 6:03 am, Dan <dfla...@rcn.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Dec 9, 5:55 am, "Karamiarokhloo, M.P. (Mehdipasha)"
>
> > <M.P.Karamiarokh...@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
>
> Somehow some specific assignments went missing in this post. Since I
> copied and pasted into the window I don't know how that could have
> happened, but use:
>
> legendW
> ticklblH
>
> to get the figure as I intended.
>
> -- Dan

I don't know why my postings are getting mangled. This is pretty
frustrating. In words, just to avoid whatever mechanism is going on:

set legendW to 20
set ticklblH to 20

the ticklblH (20) and ticklblW (30) are the pixel space allocated for
each numeric tick label. Of course, legendW (20) is the width of the
legend.

As an aside to the moderator, I would appreciate some guidance as to
how to avoid these mysterious modifications to my posts.



-- Dan

[toc] | [prev] | [next] | [standalone]


#7262

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-12-16 10:57 +0000
Message-ID<jcf873$6sj$1@smc.vnet.net>
In reply to#7196
> use:
>
> legendW
> ticklblH
>
> to get the figure as I intended.

Still without values?

Bobby

On Thu, 15 Dec 2011 03:51:58 -0600, Dan <dflatin@rcn.com> wrote:

> On Dec 14, 6:03 am, Dan <dfla...@rcn.com> wrote:
>> On Dec 9, 5:55 am, "Karamiarokhloo, M.P. (Mehdipasha)"
>>
>> <M.P.Karamiarokh...@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
>
> Somehow some specific assignments went missing in this post. Since I
> copied and pasted into the window I don't know how that could have
> happened, but use:
>
> legendW
> ticklblH
>
> to get the figure as I intended.
>
> -- Dan
>


-- 
DrMajorBob@yahoo.com

[toc] | [prev] | [next] | [standalone]


#7228

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-12-15 09:59 +0000
Message-ID<jccgdr$mgu$1@smc.vnet.net>
In reply to#7044
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@rcn.com> wrote:

> On Dec 9, 5:55 am, "Karamiarokhloo, M.P. (Mehdipasha)"
> <M.P.Karamiarokh...@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@yahoo.com

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web