Skip to content

Imshow

Inherits from (AxesImage)

A wrapper for the matplotlib.axis.Axis.imshow object.

Example
import QtQuick 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.15

import Matplotlib 1.0

Window {
    id: root

    width: 1500
    height: 800
    visible: true
    title: "Hello Python World!"

    ColumnLayout {
        anchors.fill: parent
        RowLayout {
            Button {
                text: "HOME"
                onClicked: {
                    figure.home()
                }
            }
            Button {
                text: "BACK"
                onClicked: {
                    figure.back()
                }
            }
            Button {
                text: "FORWARD"
                onClicked: {
                    figure.forward()
                }
            }
            Button {
                text: "PAN"
                onClicked: {
                    figure.pan()
                }
            }
            Button {
                text: "ZOOM"
                onClicked: {
                    figure.zoom()
                }
            }
            Text {
                text: "(" + figure.coordinates[0].toString() + ", " + figure.coordinates[1].toString() + ")"
            }           
        }
        Figure {
            id: figure
            Layout.fillWidth: true
            Layout.fillHeight: true
            coordinatesRefreshRate: 1000
            faceColor: "#293133"
            Component.onCompleted: init()

            Plot {
                faceColor: "#293133"
                Axis {
                    xAxisLabel: "X-Axis"
                    xAxisLabelFontSize: 15
                    xAxisTickColor: "white"
                    xAxisLabelColor: "white"
                    yAxisLabel: "X-Axis"
                    yAxisLabelFontSize: 15
                    yAxisTickColor: "white"
                    yAxisLabelColor: "white"                
                    Imshow {
                        x: [[1,2,3], [2,3,4]]
                        cMap: "gist_rainbow"
                        aspect: "auto"
                        extent: [0, 3, 0, 4]
                        colorbar: Colorbar {
                            tickColor: "white"
                            tickLabelColor: "white"
                        }                       
                    }
                }
            }
        }
    }   
}

Properties

aspect (String)

The default is "equal".
Python methods:

Name Parameters Return Type
get_aspect() - String
set_aspect() aspect : String None

extent (List/Tuple)

Describes the bounding box the data is stretched to fill the image. The behaviour is similar to using the xMin, xMax, yMin, yMax properties on the Axis but this won't stretch the image to the desired coordinates. The List or Tuple typically looks like this:

extent: [x_min, x_max, y_min, y_max]
Note that you can only use tuples over the python interface and not in QML. The default is None.
Python methods:

Name Parameters Return Type
get_extent() - List/Tuple
set_extent() extent : List/Tuple None

x (Array/List)

summary.The default is [].
Python methods:

Name Parameters Return Type
get_x() - Array/List
set_x() x : Array/List None

interpolation (String)

The default is antialiased.
Python methods:

Name Parameters Return Type
get_interpolation() - String
set_interpolation() interpolation : String None

origin (String)

The default is lower.
Python methods:

Name Parameters Return Type
get_origin() - String
set_origin() origin : String None

resample (Bool)

The default is False.
Python methods:

Name Parameters Return Type
get_resample() - Bool
set_resample() resample : Bool None

filternorm (Bool)

The default is True.
Python methods:

Name Parameters Return Type
get_filternorm() - Bool
set_filternorm() filternorm: Bool None

filterrad (Float)

The default is 4.0.
Python methods:

Name Parameters Return Type
get_filternorm() - Float
set_filternorm() filterrad : Float None

visible (Bool)

Whether the object is drawn on the Axes or not The default is True.
Python methods:

Name Parameters Return Type
get_visible() - Bool
set_visible() visible : Bool None

alpha (Float)

The opacity/transparency value of the Artist, This must be a value between 0 and 1. The default is None.
Python methods:

Name Parameters Return Type
get_alpha() - Float
set_alpha() alpha : Float None

label(String)

The label displayed in the legend of the plot. The default is None.
Python methods:

Name Parameters Return Type
get_label() - String
set_label() label : String None

zOrder(Integer)

Position on the z-axis of the Artist in the drawing hierarchy. Higher means further in the front. The default is 0.
Python methods:

Name Parameters Return Type
get_zorder() - Integer
set_zorder() label : Integer None

cMap (String)

The colormap of the ScalarMappable. Can b one of the Matplotlib Colormaps. The default is viridis.
Python methods:

Name Parameters Return Type
get_cmap() - String
set_cmap() x : String None

vMin (Float)

The minimum value of of the colorscale for the colormap. By default the minimum of the data is used. The default is None.
Python methods:

Name Parameters Return Type
get_vmin() - String
set_vmin() x : String None

vMax (Float)

The maximum value of of the colorscale for the colormap. By default the maximum of the data is used. The default is None.
Python methods:

Name Parameters Return Type
get_vmax() - String
set_vmax() x : String None

colorbar (Colorbar)

A Colorbar Component. The default is None.
Python methods:

Name Parameters Return Type
get_colorbar() - Colorbar
set_colorbar() colorbar : Colorbar None