Neural Sketch

Zoom & Callouts

Highlight or magnify specific parts of your diagram with zoom-based callouts.

In visual explanations, clarity often comes down to where a reader is looking—and how much detail they see. But there's a tension: if you zoom into a detail, you often lose the larger context. If you stay zoomed out, small but crucial parts become unreadable.

Zoom callouts solve this tension. They let you show detailed local structure without abandoning the global view.


Overview

When you want to magnify or "zoom in" on a region within your diagram—without obscuring the rest—Neural Sketch’s Zoom Module provides a clean solution. Built on (TikZ)'s spy library, it simplifies the creation of callout expansions and inset magnifications right inside your figures.

Use \nskZoom to highlight interesting details, show close-ups of crucial nodes, or visually emphasize components of your design—without leaving your overarching context.

Motivation

In research figures, it’s often not enough to just say "look here." You want to pull your reader’s attention into the precise detail, while preserving the full diagram. Zoom callouts solve that, giving you both an expanded local view and a contextual global view.

Basic Usage

% Minimal usage:
\nskZoom[
  type=<type>, % e.g., rectangle | circle | ...
  at=<coordinate or ID>, to=<coordinate or ID>,
  magnification=<zoom size>,
]

Where from and to anchors define your callout location (the area being magnified) and your zoomed position on the canvas.

Example:

% Suppose you want to magnify into an inset at (6,3)
\nskZoom[
  at={(3, 2)}, to={(6,3)},
  magnification=2, size=3cm,
]

This says: "Zoom into the region at (3,2), enlarge it by 2×, and place the result at (6,3)."

You get a callout lens at the original spot and a zoomed version nearby. A connecting line links them, by default styled clean and subtle.

Anatomy of a Callout

A zoom callout consists of:

  1. Source Region — where you're looking.
  2. Zoom Target — where the enlargement is placed.
  3. Lens Style — what shape surrounds the focus area.
  4. Connecting Path — how the two views are linked.

You control each with simple parameters:

\nskZoom[
  at={(x,y)}, to={(x', y')},
  magnification=2.5,
  type=circle,
  size=2.5cm,
  callout-style={dashed, thick},
  zoomed-fill=white,
  connecting-style={->, gray, thick},
]

Expressive Controls

The \nskZoom macro exposes a set of highly composable options:

KeyPurpose
atCoordinate or anchor to magnify
toCoordinate to place the magnified view
typeShape of lens: circle, rectangle, etc.
magnificationScale factor for enlargement
sizeSize of both lens and zoom box
callout-styleBorder, fill, and line style of the lens
zoomed-styleStyling of the zoom box
zoomed-fillFill color of the zoom box
connecting-styleStyle of the path between lens and zoom box
connecting-pathCustom route between the two (e.g., curved)
idAssign a reference name to the zoom element

Advanced Composition

Custom Paths

Not all callouts are best connected with a straight line. Use TikZ route syntax to bend or arc your connectors:

\nskZoom[
  at=(a), to={(7, 4)},
  connecting-path={to[out=15, in=170]},
]

This lets you route paths around content or emphasize relationships more elegantly.

Arbitrary Shapes

Callout lenses support any \nskBlock supported shape:

\nskZoom[
  type=rounded rectangle,
]

This is especially useful when the underlying content isn’t circular in nature.


In practice

examples-doc/zoom-c.tex
\nskBlock[
  type=rounded rectangle, border-radius=0mm,
  text-center=Crisp, width=2cm, height=1cm,
  fill=nskRed,
]
\nskBlock[
  type=circle,
  embed-gfx={../assets/adv_patch.png},
  last-pos=right,
]
\nskWrapUnder[\nskID!{1}]
\nskMeasure[from=\nskID!{1}.west, to=\nskID!{2}.east]
\nskBlock[
  embed-gfx={../assets/oh-7.png},
  width=\nskDistance, height=\nskDistance,
  shift-x=-5mm, shift-y=5mm,
]
\nskMark[id=zo, at={\nskID{1}}, shift-x=-6.05mm, shift-y=-6mm]
 
\nskZoom[
  type=rectangle,
  zoomed-fill=nskLightestGray,
  at=\nskID!{1}, to={(2.2, 3)},
]
 
\nskZoom[
  type=rectangle,
  zoomed-fill=nskLightestGray,
  at=\nskID!{2}, to={(5.2, 2)},
]
 
 
\nskZoom[
  type=rectangle,
  zoomed-fill=nskLightestGray,
  at=zo, to={(5.2, -3)},
]
 
\nskZoom[
  type=rectangle,
  magnification=18,
  zoomed-fill=nskLightestGray,
  at=zo, to={(-2.6, -2)},
]

This code shows how you can locate the portion of the line between A and B, then produce a circular callout lens around it with callout-style={very thick}, connect it with a dashed line, and finally display the enlarged version at (6,2). All while controlling fill, border, and magnification.

(Auto) Layering

This supports layering through our nsk python connector. Raster images, or tensor vectors/embedding are individually encoded and annotated, and separetely rendered in Neural Sketch.

If we disable the automatic layering:


Advanced Control

1. Custom Path Connection

If you need more than a straight line to connect the callout to the zoomed region, define connecting-path:

\nskZoom[
  at=(criticalPoint),
  to={(8, 3)},
  connecting-path={to[out=20, in=180]},
]

This modifies the path logic that draws the line between the callout lens and the magnified node. You can use any valid TikZ route expression, e.g. to[out=angleA, in=angleB].

2. Arbitrary Shapes

The type key can be any shape recognized by TikZ, such as circle, rectangle, or a custom shape like diamond or rounded rectangle. For rectangular shapes, corners can be further configured:

\nskZoom[
  type=rounded rectangle,
  callout-style={rounded corners=3pt, fill=nskMainAccent!15},
]

3. Integrating With Bridging or Arrows

Though typically not needed, you can combine bridging or arrowheads in the connecting path if desired:

\nskZoom[
  bridging=true,
  connecting-style={->, thick, bridging-style=arc},
]

4. Setting an Explicit id

Assign an ID if you need to reference this zoom object later:

\nskZoom[id=zoom1, ...]

Best Practices

  • Use minimal fill for the lens so the main figure remains visible beneath.
  • Keep magnification moderate (1.5x–3x) unless extreme detail is required.
  • Keep your connecting lines clean—avoid crossing other elements if possible.
  • For very detailed callouts, consider using zoomed-fill=white or a mild tinted background to ensure the magnified content stands out.

Design Tips

  • Be selective. Don’t zoom everything—highlight only what adds value.
  • Keep lines clean. Avoid crossing over unrelated content.
  • Use white or neutral fill in zoomed boxes to improve contrast.
  • Match lens shape to the visual structure underneath.

If in doubt, simpler is better.


If you’re layering multiple zoom callouts, maintain consistent styling or color scheme. That helps readers quickly parse and compare multiple highlights.


Reference Table

PropTypeDefault
id?string{}
type?token listcircle
at?token list{}
to?token list{}
magnification?number2
size?dimension2cm
callout-style?token list{}
connecting-style?token list{}
callout-border-color?token listnskMidGray
zoomed-style?token list{}
zoomed-fill?token listnskLightestGray
connecting-path?token list{}