Re: Display/manipulating numeric values inside a DynamicModule[]
- To: mathgroup at smc.vnet.net
- Subject: [mg110770] Re: Display/manipulating numeric values inside a DynamicModule[]
- From: Helen Read <hpr at together.net>
- Date: Mon, 5 Jul 2010 06:03:56 -0400 (EDT)
- References: <i0pc54$ju6$1@smc.vnet.net>
- Reply-to: HPR <read at math.uvm.edu>
On 7/4/2010 3:10 AM, Leo Alekseyev wrote: > Recently, I've been using DynamicModules[] to interactively explore > some plots that I make -- by introducing a locator, whose coordinates > allow me to trace the plotted data in some fashion (e.g. by displaying > the function value for the x coordinate of the locator, or finding the > closest plotted point to a locator in a ListPlot, etc.) My problem is > that I haven't figured out a good way to display dynamically updated > values as part of the plot or, for that matter, perform manipulations > with the dynamic values. The reason seems to be that once an > expression has head Dynamic, the behavior of many familiar functions > changes (e.g. NumericQ on a dynamic value returns False, which makes > it impossible to numerically evaluate Re or Im, etc.) Below is a > simple example of what I'm doing, and workaround that I came up with. > Here are some concrete questions: > > (a) is there a better way to display the dynamic values "a" and "b" > inside a formatted string?.. My workaround is to use something like > Grid[{{"a:", a, "; b:", b}}], which is not entirely satisfactory I use Row for that sort of thing, and use Style to format it however you like. You can style individual elements or the entire row. Row[{Style["a: ", Blue, Bold], Style[a, Bold], Style["\nb: ", Red], Style[b, 14, Italic]}] Style[Row[{"a: ", a, "\nb: ", b}], 16, Red, Bold] You can stick the Row right in a PlotLabel if you like. PlotLabel -> Style[Row[{"a: ", a, "\nb: ", b}], 16, Red, Bold] I don't have good answers for your questions (b) and (c) and will defer to others. -- Helen Read University of Vermont