148

Completely redesigned at 2015 12 19! Simplified interface, more functionality, robust performance. Plots can now be easily uploaded to StackExchange from within PlotExplorer thanks to halirutan! Code is at end of post. Functionality: Works with any graphics object, plots, charts, etc. (e.g. Plot, ListPlot, ArrayPlot, RegionPlot, GeoGraphics, BarChart, you ...


48

In addition to István's fine answer, there is also Experimental`Explore[] which provides almost all the functionalities in his PlotExplorer. I think it was Szabolcs who first told me of this function. If you call the above function with no arguments, you can choose to interactively work with either Plot, ParametricPlot, Manipulate or Graphics. Alternately, ...


31

One of the excellent places to look is the Wolfram Demonstration Project. There are many cases with custom controls there. You can test out controls immediately and download the source code. Because I know that site pretty well I will keep the list here. Relief-Shaded Elevation Map 3D Waves Potter's Wheel Motion Blur Contours of Algebraic Surfaces ...


29

This is a prototype, it can not handle Text Inset and some more complicated directives efficiently but I don't have time / motivation to improvie it. Here's something fun: g = Normal @ Show @ CommunityGraphPlot[ ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}] ]; dist = Normalize[#] (2./Pi ArcTan[Norm[5 #]]) &; DynamicModule[{drag,pts,prims}...


28

You can do this using Show and PlotRange which can be used in combination with graphs. To determine the full PlotRange of the original Graph you could use AbsoluteOptions to determine the values of the VertexCoordinates of the graph. The function CoordinateBoundingBox, introduced in V10.1, is helpful here: SeedRandom[1110]; g = RandomGraph[{70, 200}] {...


25

A lot can be tweaked, but it is hardly ever straightforward: img = Import["http://biology.usf.edu/cmmb/images/cells2.jpg"] roiSelector[img_] := DynamicModule[ {v, pt1, pt2, dim, imgDim = ImageDimensions@img, w = 300, wI, h = Automatic, ratio } , ratio = #/#2 & @@ imgDim; dim = Round[w imgDim/imgDim[[1]]]; pt1 = .3 dim; pt2 =...


23

Don't forget, with M we have all of Java at our fingertips with just a few keystrokes. So why don't you use Java Swing, which is a professional UI framework that runs on hundreds of millions of devices. I have ShowProgressBar and DestroyProgressBar in my init.m, because I use them frequently. Needs["JLink`"] ReinstallJava[] ShowProgressBar[title_String: "...


23

If you are serious about using this extensively, consider making a function based on CreateDocument... Here is one way to pursue Szabolcs's line of thought. What follows is a function based on CreateDocument[] that can be used in conjunction with the (now somewhat neglected) option DisplayFunction, which handles where the output of graphics functions should ...


23

I have finished a project where widgets like this have been useful so I thought I would share. By combining InputField and PopupMenu a searchable popup selection table can be created. searchPopup[Dynamic[selection_], list_List] := DynamicModule[{x = ""}, Grid[{{ InputField[Dynamic[x], String, Appearance -> "Frameless", ...


23

In this case I don't know how to post something helpful without providing full code so I'll just do that and hope this wasn't homework. My emphasis is on clarity (hopefully) rather than brevity or peak efficiency. flip = # /. {LightRed -> LightBlue, LightBlue -> LightRed} &; flipNeighbors[i_, j_] := (color[##] = flip @ color[##];) & @@@ ...


20

You could do create a simple graph editing tool to create a graph from scratch by doing something like this. To add edges you just click and drag. DynamicModule[{pt1, pt2, ind1, ind2, pts = {}, edges = {}, cedge = {}}, Manipulate[ EventHandler[ Dynamic@Graphics[ {Line[pts[[#]] & /@ edges], cedge, {Red, PointSize[Medium], Point[pts]}}, ...


19

The issue with such multicontroller dynamic interfaces is that one usually wants to store the state of all controllers in one variable for convenience (e.g. store status of position {i, j} as state[{i, j}] := "flagged" or state = <|{1, 1} -> 2, {1, 2} -> "flagged", ...|>). On one hand, this makes assignments easy during updating, but on the other ...


19

Intro One day I was playing with Developer` package and found DateSetter which uses some kind of floating elements that I found useful. After taking a look at a source code I found out it was FrontEnd`AttachedCell. From the code one could learn enough to create something useful: Usage FrontEnd`AttachCell[ parentObject, (*Box or Cell ...


19

Edit: Fading overlay window In order to get a top dock element with real transparency, one can create a window that overlays the current notebook window and adjusts its position together with it. With[{nb = EvaluationNotebook[]}, DynamicModule[{wm, ws}, CreateWindow[ PaletteNotebook[ {DynamicWrapper[TextCell["Click OK to close", Orange], ...


18

If you're on version 9, you can use gauges: HorizontalGauge[90, {0, 100}, ScaleRangeStyle -> Red, GaugeMarkers -> "ScaleRange"] I don't fully understand how Mathematica scales and aligns things like gauges (and it's not the sort of thing that's easy to find in the documentation) but I would explore the options using a Manipulate: Manipulate[ ...


17

Some you can find in the Documentation Center, like the angular slider in Dynamic's documentation (under Applications), or the ValueThumbSlider in the Advanced Manipulate Functionality section (under Custom Control Appearances). Some you can find in developer packages like the angular slider in the "Experimental`" package: Needs@"Experimental`"; ...


17

I know of no method by which to control the color of that element. I'm afraid that it may not be possible. I believe the style of the ProgressIndicator is taken from the OS settings, or rather the ProgressIndicator is rendered by the OS. If you look at the on-line documentation for versions 7, 8, 9 you see that the style changes: 7: 8: 9: Further, I ...


17

You can always create a new notebook and put things in it. If you are serious about using this extensively, consider making a function based on CreateDocument that sets the appropriate options for the notebook to look good. Check what CreateDocument@Plot[Sin[x],{x,0,10}] does. Or use a quick-and-dirty hack based on CreatePalette: fig = CreatePalette[#, ...


17

The quick fix is to use Block: Animate[ Block[{$PerformanceGoal = "Quality"} , Plot3D[Sin[t x y], {x, -3, 3}, {y, -3, 3} , PlotRange -> {0, 1.2} ] ] , {t, 0, 2} , AnimationRunning -> False , DisplayAllSteps -> True ]


16

Not sure if this is the best way, but you could consider something like this: Manipulate[ {x, y}, {x, Manipulator[Dynamic[x, (x = #; y = 1/#) &], {.1, 10}] &}, {y, Manipulator[Dynamic[y, (y = #; x = 1/#) &], {.1, 10}] &}, Initialization :> ({x, y} = {1, 1})] Edit V10 Since V10 one can use a shorter form: Manipulate[ {x, y} , {...


16

This? {Slider[Dynamic[x], {0, 10}], Slider[Dynamic[2 x, Set[x, #/2] &], {0, 20}]} The documentation explains, under More Information, that "Dynamic[expr,f] makes interactive operations not change expr except by virtue of the evaluation of f[val,expr]. ". Otherwise, Mathematica attempts to assign a value to 2x.


16

I'll post a function based on the title of the question. You wrap your dynamic code in profileDynamics optionally passing the option "Print"->True (defaults to False). It should be noted that this can only profile the explicit Dynamics that are on the code. Nested dynamics that are generated at runtime are not profiled by this ClearAll[profileDynamics]; ...


16

I'm not sure if this is exactly what you need but this is what I've recently done to inform the user about ongoing calculation. Usage withProgressIndicator[proc, delay] Performs a proc, and when it lasts longer than delay (default 0), a progress indicator in dialog is created. It will be closed after finishing the proc. It should be run on Main Link, ...


16

OK, I guess I found something myself while trying to circumvent RunScheduledTask. DynamicModule[{prog = False}, Column[{ Button[ "Do heavy work", prog = True; Pause[10]; prog = False, Method -> "Queued" ], Dynamic@If[prog, ProgressIndicator[Appearance -> "Percolate"], Invisible[ProgressIndicator[Appearance ->...


15

You want to use Grid. Code Panel[ Grid[ { (* The 1st row *) { Row[{"Board size: ", InputField[Dynamic[max], Number, FieldSize -> 3]}], Button["Clear Board", ImageSize -> All] }, (* The 2nd row *) { Graphics[Circle[], ImageSize -> 300], SpanFromLeft } }, Alignment -> {{Left, Right}, Baseline}] ] ...


15

Suppose we have a Graphics object which depends on some parameters and a controller with which we want to control these parameters. This could be done easily enough using the second argument of Dynamic, for example gr[pts_, col_, radius_] := Graphics[{col, Disk[#, radius] & /@ pts}, PlotRange -> {{0, 3}, {0, 3}}, ImageSize -> 200]; contrl = {...


15

If you notice Mathematica Documentation Center search field is kind of the same thing. And search window from Ctrl-F too. It uses a similar concept to what I'll show. Important thing to know is that EventHandler can track commands from the Mathematica menu. There is an undocumented option HandleShiftReturn and here is a trick I learned from FW: ...


15

Based on undocumented FrontEnd`AttachCell: What is FrontEnd`AttachedCell? And Experimental`Autocompletebut this can be replaced with Mike's approach. Need to work on style, automatic scrolling and some edge cases, but already works quite well. Feedback appreciated. Column[{ searchPopup2[Dynamic[selection], list], Graphics@Disk[] }] Code ...


15

You are almost there but VertexDelete[graph, n] or e.g. SetProperty[graph, spec] won't affect graph they way you are expecting unless you set it again: graph = VertexDelete[graph, n]. DynamicModule[{graph} , Dynamic[graph] , Initialization :> ( graph = Graph[ {1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -&...


15

n = 120; names = Range[n]; pts = AssociationThread[names -> N@CirclePoints[n]]; edges = RandomSample[Subsets[names, {2}], 250]; There are two reasons why Dynamic scales badly: there is no (documented) way to tell a "DynamicObject" to update, one can only count on dependency tree which is created. one can track only Symbols The second one implies that ...


Only top voted, non community-wiki answers of a minimum length are eligible