« first day (234 days earlier)      last day (593 days later) » 

4:17 AM
A quickie: can anybody explain the result of FreeQ[{0, 0}, Except[0]]?
 
4:59 AM
@J.M. I think it is so because it matches _List at level {1}
Try FreeQ[{0, 0}, Except[0], {2}]
(True)
You momma's so blind she can't see a list in {0, 0}
 
@belisarius Ah, the head. Thanks.
 
@J.M. Also, Leonid wrote something witty about the particularities of the Except[] pattern somewhere, but I can't find it
 
 
4 hours later…
8:55 AM
\o/
 
9:08 AM
@Verbeia 'grats. :)
 
thanks @J.M.
I've had a bit of a surge of late, it seems. I didn't expect to get their till October sometime.
 
@Verbeia Ups and downs, y'know. :)
 
 
5 hours later…
R.M
2:28 PM
@Verbeia congrats!
 
 
2 hours later…
4:48 PM
@R.M hello; I am interested in your post mathematica.stackexchange.com/questions/2058/… I would like to write a function which could post process a given ContourPlot or DensityPlot and add a color bar as you did in that post but with the proper scaling
for instance if I replace Sin[..] by 2 Sin[..] in your example, the scaling on the color bar will be wrong.
so the challenge is extracting the range from the previous plot.
 
 
1 hour later…
6:07 PM
@R.M I don't think so, but Experimental`OptimizeExpression is IMO one of the best-known undocumented functions, so it gets mentioned everywhere. Feel free to ask a question if you want to get some quasi-official documentation on it on the site.
@R.M oh, Daniel mentioned it here on SO, apparently. (I wasn't on SO, so I missed that.)
 
7:09 PM
@R.M I have started with this `
Clear[colorbar]
colorbar[colorFunction_: Automatic, divs_: 150] :=
DensityPlot[y, {x, 0, .1}, {y, 0, 1}, AspectRatio -> Automatic,
PlotRangePadding -> 0, PlotPoints -> {2, divs}, MaxRecursion -> 0,
FrameTicks -> {None, Automatic, None, None},
ColorFunction -> colorFunction]
ColorBar[plot_, cf_: "Heat"] :=
With[{size = 300}, Row[Show[#, ImageSize -> {Automatic, size},
ImagePadding -> 20] & /@ {plot, colorbar[cf]}]]
ContourPlot[2 Sin[Norm[{x, y}]], {x, 0, 10}, {y, 0, 10}, ColorFunction -> "Heat"] // ColorBar[#, "Heat"] &`
I guess I am just after a smart way of extracting from the existing plot the range of contours (or heights) it has drawn.
should I post this as a question?
 
It's fun to look at this:
 
 
3 hours later…
R.M
10:20 PM
@chris To do that, you'll have to change colorbar a bit to accept a min and max values for the range. For example:
Clear[colorbar]
colorbar[{min_, max_}, colorFunction_: Automatic, divs_: 150] :=
 DensityPlot[y, {x, 0, 0.1}, {y, min, max}, AspectRatio -> Automatic,
  PlotRangePadding -> 0, PlotPoints -> {2, divs}, MaxRecursion -> 0,
  FrameTicks -> {None, Automatic, None, None},
  ColorFunction -> colorFunction]
There are several ways in which you can get the min/max values from a plot. For a simple line plot, it might be as simple as inspecting the FullForm and picking out the max value from the Line[...] part.
But a general way to do this would be using EvaluationMonitor to sow the values of the function, then take the min/max of that and feed it to the modified colorbar function
As an example:
With[{func = 2 Sin[Norm[{#1, #2}]] &, size = 300, cf = "Heat"},
  	Row[Show[#, ImageSize -> {Automatic, 300},
        ImagePadding -> 20] & /@ {#1,
       colorbar[Through[{Min, Max}[#2]], cf]} & @@
    Reap[ContourPlot[func[x, y], {x, 0, 10}, {y, 0, 10},
      ColorFunction -> cf, EvaluationMonitor :> Sow[func[x, y]]]]]
 ]
Also, you might want to either set a fixed aspect ratio in the colorbar instead of Automatic or some scaled value of max-min
 

« first day (234 days earlier)      last day (593 days later) »