# Tag Info

112

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, ...

36

In addition to István's fine answer, there is also ExperimentalExplore[] 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, ...

27

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 ...

23

Edit: getting rid of FilledCurve to speed things up. Here's something fun: g = Normal @ Show @ CommunityGraphPlot[ ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}] ]; dist = Normalize[#] (2./Pi ArcTan[Norm[5 #]]) &; DynamicModule[{drag,pts,prims} , pts = Union@Cases[g, {_?NumericQ, _?NumericQ}, \[Infinity]]; prims = ( First[g] /...

22

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", ...

21

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 ...

20

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}] {...

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[#, ...

16

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]}}, ...

16

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"; ...

15

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 FrontEndAttachedCell. From the code one could learn enough to create something useful: Usage FrontEndAttachCell[ parentObject, (*Box or Cell ...

14

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}] ] ...

14

Since Input is a DialogInput, it seemed reasonable to peek into Input's structure to understand how the focus is set. After removing the ReadProtected attribute I've realized that there is no neat way to do it, as WRI itself has done the reposition of the focus via successive SelectionMove calls. This example below is not the original but a modified version,...

14

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]; ...

14

Based on undocumented FrontEndAttachCell: What is FrontEndAttachedCell? And ExperimentalAutocompletebut 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 ...

13

This solution relies on putting a TagBox with a custom tag around the part to be replaced, reading the cell and replacing the tag, then writing it back. Personally I've always felt that the need to read the entire cell and write it all again seems kind of clunky, but I don't know of a better way to do this. MakeBoxes[replacementMarker[a_,tag_],StandardForm]^...

13

This is a bit more complicated, but I did this for a human experiment previously, so why not share it. The code keeps track of nodes and edges of a graph that can be manipulated: new edges can be drawn by dragging the mouse from one node to the other edges can be deleted via right-click menu nodes can be moved by dragging while holding Ctrl node can be ...

12

I think these questions being indeed basic, are rather important. I cannot answer the first two myself, though would love to see some methods that can deal with them. As always, there are other ways to solve the remaining two questions. Since Mathematica is not designed to produce standalone ("executable") files, you need to have either Mathematica or the ...

12

I would suggest using the second argument of Dynamic: DynamicModule[{shape = Disk[], targets = RandomPoint[Disk[], 10]}, Panel@Column@{ Item[ RadioButtonBar[Dynamic[ shape, (targets = RandomPoint[#, 10]; shape = #) & ], {Disk[] -> "Disk", Rectangle[] -> "Rectangle"}], Alignment -> Center ], Dynamic@...

11

Try: Button["Select this cell", SelectionMove[ButtonNotebook[], All, EvaluationCell]]

11

You can use a combination of MouseDown and MouseClickCount as in the following examples: example 1: double-click increments the value of j: j = 1; EventHandler[Panel[Dynamic[j]], "MouseDown" :> If[CurrentValue["MouseClickCount"] == 2, ++j]] example 2: double-click toggles the text color: DynamicModule[{col = Green}, EventHandler[ Style["text"...

10

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: ...

10

You can also look at the GUIKit package which allows you to create complicated widgets and panels that mimic the look and feel of the OS. The user guide/tutorial is pretty decent and has several examples too that you can learn from and modify to your needs. In fact, a lot of the additional editing/explorer functionality like GraphEdit and DatabaseExplorer ...

10

Like this Slider[Dynamic[y,(y=#;f[y])&],{1,4}] You can can test using for example f[y_]:=Print@y; I advise you to look at the help of Dynamic that contains examples of other related features.

10

It turned out that the MathematicaClosingDialog.nb is a nice example for a graphical user interface that solely uses the FrontEnd MathKernel. On the downside, one has to deal with low-level code. First I made a copy of the original MathematicaClosingDialog.nb, renamed it as MathematicaClosingDialog_Default.nb, and then imported it into a notebook: nb = ...

10

Quick fix is to use e.g. Inactivate and friends: Manipulate[ Column[{ Activate @ #, Panel @ ExpressionCell[ # /. Inactive -> Defer, "Notebook", "Input" ] }] & @ Inactivate @ Plot[Sin[x], {x, -3, 3}, AxesLabel -> {xlabel, ylabel}, Ticks -> {tics, tics}] , Control[{{tics, Automatic, ""}, {Automatic -&...

10

Whole ListPlot is recalculated at each click because clicks value has changed, you can isolate Dynamic parts of graphics in Epilog to avoid that. Using EventHandlers there will allow you to drop clicked points. testdata = Array[{#, 1 + #^2*RandomReal[]} &, 100]; clicks = {testdata[[1]], testdata[[-1]]}; ListPlot[ Button[Tooltip @ #, AppendTo[...

10

You are almost there but Graphs are not mutable so: DynamicModule[{graph}, Dynamic[graph] , Initialization :> ( graph = Graph[ {1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2}, VertexLabels -> "Name", VertexShapeFunction -> ( EventHandler[ Disk[#1, .1], "MouseClicked" :> (graph = ...

9

This solution illustrates using Spacer. Move the slider to place the button anywhere you want along the width of interface: Manipulate[Panel[Column[{Row[{"Board size: ",InputField[Dynamic[max], Number, FieldSize -> 3], Spacer[spacer], Button["Clear Board"]}], Plot[Sin[x], {x, -3, 3}, ImageSize -> 400]}]], {{spacer, 100}, 0, 220}, FrameMargins -> ...

9

Not 100% solution, but this may work. Define: dialog := CreateDialog[{TextCell["Click OK to close"], DefaultButton[]}, Modal -> True, NotebookEventActions -> {"WindowClose" :> dialog}] Then call: dialog At least, it reappears :)

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