QwtPlotLayout — PythonQwt 0.14 Manual (original) (raw)

class qwt.plot_layout.QwtPlotLayout[source]

Layout engine for QwtPlot.

It is used by the QwtPlot widget to organize its internal widgets or by QwtPlot.print() to render its content to a QPaintDevice like a QPrinter, QPixmap/QImage or QSvgRenderer.

Valid options:

setCanvasMargin(margin, axis=-1)[source]

Change a margin of the canvas. The margin is the space above/below the scale ticks. A negative margin will be set to -1, excluding the borders of the scales.

Parameters:

Warning

The margin will have no effect when alignCanvasToScale() is True

canvasMargin(axisId)[source]

Parameters:

axisId (int) – Axis index

Returns:

Margin around the scale tick borders

See also

setCanvasMargin()

setAlignCanvasToScales(*args)[source]

Change the align-canvas-to-axis-scales setting.

setAlignCanvasToScales(on):

Set the align-canvas-to-axis-scales flag for all axes

Parameters:

on (bool) – True/False

setAlignCanvasToScales(axisId, on):

Change the align-canvas-to-axis-scales setting. The canvas may:

The axisId parameter is somehow confusing as it identifies a border of the plot and not the axes, that are aligned. F.e whenQwtPlot.yLeft is set, the left end of the the x-axes (QwtPlot.xTop, QwtPlot.xBottom) is aligned.

Parameters:

See also

setAlignCanvasToScale(),alignCanvasToScale()

alignCanvasToScale(axisId)[source]

Return the align-canvas-to-axis-scales setting. The canvas may:

Parameters:

axisId (int) – Axis index

Returns:

align-canvas-to-axis-scales setting

See also

setAlignCanvasToScale(), setCanvasMargin()

setSpacing(spacing)[source]

Change the spacing of the plot. The spacing is the distance between the plot components.

Parameters:

spacing (int) – New spacing

spacing()[source]

Returns:

Spacing

See also

margin(), setSpacing()

setLegendPosition(*args)[source]

Specify the position of the legend

setLegendPosition(pos, [ratio=0.]):

Specify the position of the legend

Parameters:

The legend will be shrunk if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5.

Valid position values:

legendPosition()[source]

Returns:

Position of the legend

See also

legendPosition()

setLegendRatio(ratio)[source]

Specify the relative size of the legend in the plot

Parameters:

ratio (float) – Ratio between legend and the bounding rectangle of title, footer, canvas and axes

The legend will be shrunk if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5.

legendRatio()[source]

Returns:

The relative size of the legend in the plot.

See also

setLegendRatio()

setTitleRect(rect)[source]

Set the geometry for the title

This method is intended to be used from derived layouts overloading activate()

Parameters:

rect (QRectF) – Rectangle

See also

titleRect(), activate()

titleRect()[source]

Returns:

Geometry for the title

See also

invalidate(), activate()

Set the geometry for the footer

This method is intended to be used from derived layouts overloading activate()

Parameters:

rect (QRectF) – Rectangle

See also

footerRect(), activate()

Returns:

Geometry for the footer

See also

invalidate(), activate()

setLegendRect(rect)[source]

Set the geometry for the legend

This method is intended to be used from derived layouts overloading activate()

Parameters:

rect (QRectF) – Rectangle for the legend

See also

footerRect(), activate()

legendRect()[source]

Returns:

Geometry for the legend

See also

invalidate(), activate()

setScaleRect(axis, rect)[source]

Set the geometry for an axis

This method is intended to be used from derived layouts overloading activate()

Parameters:

See also

scaleRect(), activate()

scaleRect(axis)[source]

Parameters:

axisId (int) – Axis index

Returns:

Geometry for the scale

See also

invalidate(), activate()

setCanvasRect(rect)[source]

Set the geometry for the canvas

This method is intended to be used from derived layouts overloading activate()

Parameters:

rect (QRectF) – Rectangle

See also

canvasRect(), activate()

canvasRect()[source]

Returns:

Geometry for the canvas

See also

invalidate(), activate()

invalidate()[source]

Invalidate the geometry of all components.

minimumSizeHint(plot)[source]

Parameters:

plot (qwt.plot.QwtPlot) – Plot widget

Returns:

Minimum size hint

layoutLegend(options, rect)[source]

Find the geometry for the legend

Parameters:

Returns:

Geometry for the legend

alignLegend(canvasRect, legendRect)[source]

Align the legend to the canvas

Parameters:

Returns:

Geometry for the aligned legend

expandLineBreaks(options, rect)[source]

Expand all line breaks in text labels, and calculate the height of their widgets in orientation of the text.

Parameters:

Returns:

tuple (dimTitle, dimFooter, dimAxes)

Returns:

alignScales(options, canvasRect, scaleRect)[source]

Align the ticks of the axis to the canvas borders using the empty corners.

Parameters:

activate(plot, plotRect, options=0)[source]

Recalculate the geometry of all components.

Parameters: