Inward-Facing Ticks Usage Guide¶
QwtPlot::TickDirection controls where axis tick marks are drawn: inside the plot area instead of outside the axis line. This suits compact layouts or special visual effects.
Main Features¶
Ticks can point outward (the default) or inward. Each axis (XBottom, XTop, YLeft, YRight) is configured independently. Inward ticks use the same length, color and line width as outward ticks, and the direction can be switched at any time without resetting the tick style.
Basic Concepts¶
Tick Direction Description¶
In traditional plots, axis tick marks extend outward from the axis line (outward display). The inward tick feature makes tick marks extend inward from the canvas edge, achieving different visual effects.
1 2 3 4 5 6 7 8 9 10 11 12 | |
TickDirection Enum¶
| Enum Value | Description |
|---|---|
QwtPlot::TickOutside |
Outward ticks (default behavior) |
QwtPlot::TickInside |
Inward ticks, extending inward from canvas edge |
Usage¶
An example of inward tick display is located at: examples/2D/ticks_inside. Screenshot:

1. Basic Usage¶
Setting the tick direction for a single axis:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
2. Querying Current Settings¶
Getting the current tick direction of an axis:
1 2 3 4 5 6 7 8 | |
3. Restoring Default Settings¶
Restoring tick direction to the default outward display:
1 2 3 4 5 6 | |
4. Batch Setting All Axes¶
Setting tick direction for multiple axes simultaneously:
1 2 3 4 5 6 7 | |
Core Methods¶
| Method | Parameters | Description |
|---|---|---|
setAxisTickDirection(axisId, direction) |
QwtAxisId, TickDirection | Set tick direction for specified axis |
axisTickDirection(axisId) |
QwtAxisId | Get tick direction for specified axis |
Notes¶
Info — Style Inheritance
Inward tick marks automatically inherit the style settings of outward ticks, including:
- Tick length (set viaQwtScaleDraw::setTickLength())
- Line width (set viaQwtScaleDraw::setPenWidthF())
- Color (set viaQwtScaleWidget::setScaleColor())Warning — Refresh Timing
Calling
setAxisTickDirection()automatically triggersautoRefresh(). WhenautoReplotis enabled, it will refresh automatically. To refresh immediately, callreplot().Tip — Use with Parasite Axes
The inward tick feature can be used with parasite plots (Parasite Plot). Each parasite plot can independently set its tick direction.
Differences from QwtPlotScaleItem¶
| Feature | TickDirection | QwtPlotScaleItem |
|---|---|---|
| Purpose | Control main axis tick direction | Add additional axes inside canvas |
| Tick Style | Inherits main axis style | Can set style independently |
| Display Position | Replaces/changes main axis ticks | Overlays as independent layer |
| Use Cases | Compact layout or special effects needed | Reference scales needed inside canvas |
Example — Example Code
Complete example located at:
examples/2D/ticks_inside/This example demonstrates:
- Independent control of four axes
- Real-time tick direction switching
- Batch setting functionality
References¶
- Axis Widget - Detailed QwtScaleWidget documentation
- Creating Multiple Axes - Parasite axis feature
- API documentation:
QwtPlot::setAxisTickDirection()