Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Defining the labels to display in ContourLabels

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121463] Re: Defining the labels to display in ContourLabels
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 16 Sep 2011 05:47:04 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <621500.69778.1316074022235.JavaMail.root@m06>

The Presentations package has a DrawLineLabels routine that can be used to
label any list of curves that are characterized by constant value functions
- such as contour lines. This allows a selected set of lines to be labeled.

Here is the plotting statement for your example.

<< Presentations` 

Module[
 {contourlist = Range[9]/10 // N,
  labeledlist = Range[1, 9, 2]/10 // N, f, g},
 f[x_, y_] := Cos[x*y]/Exp[x^2 + y^2];
 Draw2D[
  {g = ContourDraw[f[x, y], {x, -2, 2}, {y, -2, 2},
     Contours -> contourlist,
     ContourLabels -> None,
     ColorFunction -> ColorData["BrownCyanTones"]],
   g // DrawLineLabels[f[#1, #2] &, 0.4 + #/10 &, 0.001, labeledlist,
     DrawLLTextOptions -> {Background -> ColorData["Legacy", "Gold"], 
       BaseStyle -> {FontSize -> 8, FontFamily -> "Helvetica"}}]},
  Frame -> True,
  ImageSize -> 250]
 ] 

A PDF and notebook with extended discussion, and an additional method, will
appear at Peter Lindsay's site at St. Andrews University. 

http://www.st-andrews.ac.uk/~pl10/c/djmpark/ 


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









From: Luiz Melo [mailto:lmelo at ufsj.edu.br] 

Hi there. Assuming:

ContourPlot[Cos[x*y]/Exp[x^2 + y^2], {x, -2, 2}, {y, -2, 2}, ContourLabels
-> All, Contours -> 9]

I would like to keep the number of contours (9) and to label only those of
values 0.9, 0.7, 0.5, 0.3, 0.1

How?

Thank you.

-- 
Prof. *Luiz Guilherme C.
Melo*<https://sites.google.com/site/luizguilhermecmelo/home>
Telecommunication engineering
Universidade Federal Sao Joao del-Rei
Campus Alto Paraopeba
Rodovia MG 443, Km 7
Ouro Branco - MG
36420-000 - Brazil





  • Prev by Date: Re: Coloring function
  • Next by Date: Re: Question on SmoothKernelDistribution, value of computed bandwidth? (vrs. 8.01)
  • Previous by thread: Re: Defining the labels to display in ContourLabels
  • Next by thread: Re: Defining the labels to display in ContourLabels