mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-26 02:21:43 +08:00
.. | ||
CMakeLists.txt | ||
geo_coordinateaxis0.cpp | ||
README.md |
Example (JKQTPlotter): Plot With Axes through Origin
This example draws a coordinate system with several geomtric shapes, where the coordinate axes pass through the origin of the plot, not at the borders. Note that if you move the displayed coordinate ranges, so 0 is not in them, the axes still stick to the borders.
The source code of the main application can be found in geo_coordinateaxis0.cpp
.
Apart from the usual code to set up the graphs, the following fragment switches the "normal" axes at the borders off and the zero axis on:
plot.getXAxis()->setShowZeroAxis(false);
plot.getYAxis()->setShowZeroAxis(false);
plot.getXAxis()->setDrawMode1(JKQTPCADMnone);
plot.getXAxis()->setDrawMode2(JKQTPCADMnone);
plot.getXAxis()->setDrawMode0(JKQTPCADMcomplete|JKQTPCADMMaxFilledArrow);
plot.getXAxis()->setLabelPosition(JKQTPLabelMax);
plot.getXAxis()->setAxisLabel("$X$ Coordinate");
plot.getYAxis()->setDrawMode1(JKQTPCADMnone);
plot.getYAxis()->setDrawMode2(JKQTPCADMnone);
plot.getYAxis()->setDrawMode0(JKQTPCADMcomplete|JKQTPCADMMaxFilledArrow);
plot.getYAxis()->setLabelPosition(JKQTPLabelMax);
plot.getYAxis()->setAxisLabel("$Y$ Coordinate");
The axes are configured to have an arrow at their max end (|JKQTPCADMMaxFilledArrow
) and the axis label is also positioned close to the axis max.
The resulting plot looks like this: