Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Extracting contour values from ContourPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100844] Re: Extracting contour values from ContourPlot
  • From: computer algebra <mike.honeychurch at gmail.com>
  • Date: Tue, 16 Jun 2009 21:50:03 -0400 (EDT)
  • References: <h12gg4$ect$1@smc.vnet.net> <h13vp8$8pm$1@smc.vnet.net>

On Jun 15, 4:37 am, dg <davide.guari... at gmail.com> wrote:
> On Jun 14, 4:06 pm, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de>
> wrote:
>
> > Hi,
>
> > plt = ContourPlot[Cos[x*y], {x, -Pi, Pi}, {y, -Pi, Pi}];
>
> > and
>
> > Cases[plt, _Tooltip, Infinity] /. Tooltip[_, lbl_] :> lbl
>
> > ?
>
> > Regards
> >    Jens
>
> Thanks, but this only put labels on the contours inside the plot.
> Perhaps I wasn't very clear. I know I can label the lines inside the
> plot. That's not what I want. I want a separate legend.

How about this:

plt = ContourPlot[Cos[x*y], {x, -Pi, Pi}, {y, -Pi, Pi},
  PlotRangePadding -> 0, ColorFunction -> "LakeColors"];

colourmap =
 DensityPlot[x, {x, -1, 1}, {y, 0, 1},
  ColorFunction -> Function[{x}, ColorData["LakeColors"][x]],
  Mesh -> False,
  PlotPoints -> 50,
  PlotRangePadding -> 0,
  ImageSize -> {400, 40},
  AspectRatio -> 0.05,
  FrameTicks -> {Automatic, None, None, None}];

Graphics[{Inset[Rotate[colourmap, 90 \[Degree]], {1.1, 0.33},
   Center, {2, 2}], Inset[plt, {-0.1, .3}, Center, {2., 2.}]},
 PlotRange -> 1.5, ImageSize -> 600]

Ideally you would also want a tick function to rotate the tick labels
on the legend.

Mike


  • Prev by Date: Re: Extracting contour values from ContourPlot
  • Next by Date: "DayNameShort" // Chinese, Japanese
  • Previous by thread: Re: Extracting contour values from ContourPlot
  • Next by thread: Re: Extracting contour values from ContourPlot