Skip to main content

Graph

Namespace: DISPLIB  ·  Library: Display Library

#include <disp/graph.h>

class DISPLIB::Graph

Common base widget providing title, axis labels and resize handling for DISPLIB's QPainter plots.

Subclasses such as Plot and ImageSc paint inside the content rectangle that Graph leaves free after stamping the title bar at the top and the x / y axis labels on the bottom and left margins.

src/examples/ex_disp_plots/main.cpp
VectorXd samples = VectorXd::LinSpaced(50, -1.0, 1.0);
Plot plot(samples); // Plot is a Graph with title and axis labels
plot.setTitle("ramp");
plot.setXLabel("sample");
plot.setYLabel("value");

Inheritance​


Public Methods​

Graph(parent)​

The constructor.

Parameters:

  • parent : *QWidget ** The parent widget.

init()​

Init this class.


setTitle(p_sTitle)​

Sets the scaled image view title.

Parameters:

  • p_sTitle : const QString & The title.

setXLabel(p_sXLabel)​

Sets the label of the y axes.

Parameters:

  • p_sXLabel : const QString & The x axes label.

setYLabel(p_sYLabel)​

Sets the label of the y axes.

Parameters:

  • p_sYLabel : const QString & The y axes label.

Example​

Used in examples​

ex_disp_plots​

Disp plots: colour maps, bar and spline histograms, line plots, image and time-frequency maps.

src/examples/ex_disp_plots/main.cpp, line 184
VectorXd samples = VectorXd::LinSpaced(50, -1.0, 1.0);
Plot plot(samples); // Plot is a Graph with title and axis labels
plot.setTitle("ramp");
plot.setXLabel("sample");
plot.setYLabel("value");
const QImage plotImage = render(plot);
ok &= expect(countColor(plotImage, qRgb(255, 255, 255), 0) < plotImage.width() * plotImage.height(), "Plot renders axes and data");

Authors of this file​