Function Repository Resource:

DragZoomGraphics

Source Notebook

Drag and zoom for Graphics expressions

Contributed by: Nikolay Murzin

ResourceFunction["DragZoomGraphics"][g]

makes a dynamic version of the Graphics expression g that enables dragging and zooming.

ResourceFunction["DragZoomGraphics"][g,zoom]

specifies a zoom factor.

Details and Options

Click and drag to pan the view.
One can zoom in with ( on macOS).
One can zoom out with .
ResourceFunction["DragZoomGraphics"] supports all options of Graphics.

Examples

Basic Examples (1) 

Explore Mandelbrot graphics:

In[1]:=
ResourceFunction["DragZoomGraphics"][MandelbrotSetPlot[], Frame -> False]
Out[1]=

Neat Examples (1) 

Explore fractal curves:

In[2]:=
fractalCurve[angles_ /; VectorQ[angles, NumericQ], n_Integer?Positive] := With[{m = Length@angles},
  Graphics@
   Line@AnglePath@
     angles[[RealDigits[Most@Subdivide[m^n], m][[All, 1, -1]] + 1]]
  ]
In[3]:=
ResourceFunction["DragZoomGraphics"][
 fractalCurve[{0, 45 °, -90 °, 45 °}, 8]]
Out[3]=
In[4]:=
ResourceFunction["DragZoomGraphics"][
 fractalCurve[{0 °, 90 °, -90 °, -90 °, 0 °, 90 °, 90 °, -90 °}, 5]]
Out[4]=

Publisher

N. Murzin

Version History

  • 1.0.0 – 15 May 2020

Related Resources

License Information