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


Groups > comp.soft-sys.math.mathematica > #5003

Re: Defining the labels to display in ContourLabels

From "David Park" <djmpark@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Defining the labels to display in ContourLabels
Date 2011-09-16 09:50 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j4v64i$c65$1@smc.vnet.net> (permalink)
References <621500.69778.1316074022235.JavaMail.root@m06>

Show all headers | View raw


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@comcast.net
http://home.comcast.net/~djmpark/  









From: Luiz Melo [mailto:lmelo@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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Defining the labels to display in ContourLabels "David Park" <djmpark@comcast.net> - 2011-09-16 09:50 +0000

csiph-web