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

MathGroup Archive 2012

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

Search the Archive

Cool example with ContourPlot+EvaluationMonitor

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125518] Cool example with ContourPlot+EvaluationMonitor
  • From: psycho_dad <s.nesseris at gmail.com>
  • Date: Sat, 17 Mar 2012 02:49:44 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

The following example shows in real-time (sort of) how ContourPlot calculates a contour (in this example a unit circle):

f[x_, y_, freeze_] := (Pause[freeze]; (x^2 + y^2))
data = {}; freeze = 0.04;
Dynamic[ListPlot[data, Frame -> True, AspectRatio -> 1, 
  PlotStyle -> Blue, PlotRange -> {{-1.6, 1.6}, {-1.6, 1.6}}, 
  Epilog -> Circle[{0, 0}]]]
ContourPlot[f[x, y, freeze] == 1, {x, -1.5, 1.5}, {y, -1.5, 1.5}, 
  EvaluationMonitor :> AppendTo[data, {x, y}]];

Initially I just wanted to get all the points from ContourPlot, but then it dawned on me that using Dynamic I could do that in real time! I hope you like it :D

Cheers  

PS Change the parameter freeze (set to 0.04 secs) to make the animation slower or faster.
PPS This is so cool, I just knew I had to share it!



  • Prev by Date: Two Window Application
  • Next by Date: replace one rule in a list of rules
  • Previous by thread: Two Window Application
  • Next by thread: Re: Cool example with ContourPlot+EvaluationMonitor