Image
Display an image, i.e.
data on a 2D regular raster. By default, when an image is displayed in a subplot, its y axis
will be reversed (ie. autorange: 'reversed'
), constrained to the domain (ie. constrain:
'domain'
) and it will have the same scale as its x axis (ie. scaleanchor: 'x,
) in order for
pixels to be rendered as squares.
-
Corresponding Plotly trace type.
Declaration
Swift
public let type: String
-
Switch indicating whether the trace supports animation of its data.
Declaration
Swift
public static var animatable: Bool { get }
-
Determines whether or not this trace is visible.
If legendonly, the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).
Declaration
Swift
public var visible: Visible?
-
Sets the opacity of the trace.
Declaration
Swift
public var opacity: Double?
-
Sets the trace name.
The trace name appear as the legend item and on hover.
Declaration
Swift
public var name: String?
-
Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.
Declaration
Swift
public var uid: String?
-
Assigns id labels to each datum.
These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.
Declaration
Swift
public var ids: [String]?
-
Assigns extra data each datum.
This may be useful when listening to hover, click and selection events. Note that, scatter traces also appends customdata items in the markers DOM elements
Declaration
Swift
public var customData: [String]?
-
Assigns extra meta information associated with this trace that can be used in various text attributes.
Attributes such as trace
name
, graph, axis and colorbartitle.text
, annotationtext
rangeselector
,updatemenues
andsliders
label
text all supportmeta
. To access the tracemeta
values in an attribute in the same trace, simply use%{meta[i]}
wherei
is the index or key of themeta
item in question. To access tracemeta
in layout attributes, use%{data[n[.meta[i]}
wherei
is the index or key of themeta
andn
is the trace index. -
Undocumented
Declaration
Swift
public var hoverLabel: HoverLabel?
-
Undocumented
Declaration
Swift
public var stream: Stream?
-
Controls persistence of some user-driven changes to the trace:
constraintrange
inparcoords
traces, as well as someeditable: true
modifications such asname
andcolorbar.title
.Defaults to
layout.uirevision
. Note that other user-driven trace attribute changes are controlled bylayout
attributes:trace.visible
is controlled bylayout.legend.uirevision
,selectedpoints
is controlled bylayout.selectionrevision
, andcolorbar.(x|y)
(accessible withconfig: {editable: true}
) is controlled bylayout.editrevision
. Trace changes are tracked byuid
, which only falls back on trace index if nouid
is provided. So if your app can add/remove traces before the end of thedata
array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace auid
that stays with it as it moves.Declaration
Swift
public var uiRevision: Anything?
-
Specifies the data URI of the image to be visualized.
The URI consists of “data:image/[
][;base64],” Declaration
Swift
public var source: String?
-
A 2-dimensional array in which each element is an array of 3 or 4 numbers representing a color.
Declaration
Swift
public var z: ZData?
-
Color model used to map the numerical color components described in
z
into colors.If
source
is specified, this attribute will be set torgba256
otherwise it defaults torgb
.Declaration
Swift
public var colorModel: ColorModel?
-
Array defining the lower bound for each color component.
Note that the default value will depend on the colormodel. For the
rgb
colormodel, it is [0, 0, 0]. For thergba
colormodel, it is [0, 0, 0, 0]. For thergba256
colormodel, it is [0, 0, 0, 0]. For thehsl
colormodel, it is [0, 0, 0]. For thehsla
colormodel, it is [0, 0, 0, 0].Declaration
Swift
public var zMin: InfoArray?
-
Array defining the higher bound for each color component.
Note that the default value will depend on the colormodel. For the
rgb
colormodel, it is [255, 255, 255]. For thergba
colormodel, it is [255, 255, 255, 1]. For thergba256
colormodel, it is [255, 255, 255, 255]. For thehsl
colormodel, it is [360, 100, 100]. For thehsla
colormodel, it is [360, 100, 100, 1].Declaration
Swift
public var zMax: InfoArray?
-
Set the image’s x position.
Declaration
Swift
public var x0: Anything?
-
Set the image’s y position.
Declaration
Swift
public var y0: Anything?
-
Set the pixel’s horizontal size.
Declaration
Swift
public var dx: Double?
-
Set the pixel’s vertical size
Declaration
Swift
public var dy: Double?
-
Sets the text elements associated with each z value.
Declaration
Swift
public var text: Data<String>?
-
Determines which trace information appear on hover.
If
See morenone
orskip
are set, no information is displayed upon hovering. But, ifnone
is set, click and hover events are still fired.Declaration
Swift
public struct HoverInfo : OptionSet, Encodable
-
Determines which trace information appear on hover.
If
none
orskip
are set, no information is displayed upon hovering. But, ifnone
is set, click and hover events are still fired.Declaration
Swift
public var hoverInfo: HoverInfo?
-
Template string used for rendering the information that appear on hover box.
Note that this will override
hoverinfo
. Variables are inserted using %{variable}, for example “y: %{y}”. Numbers are formatted using d3-format’s syntax %{variable:d3-format}, for example “Price: %{y:$.2f}”. https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format for details on the formatting syntax. Dates are formatted using d3-time-format’s syntax %{variable|d3-time-format}, for example “Day: %{2019-01-01|%A}”. https://github.com/d3/d3-time-format#locale_format for details on the date formatting syntax. The variables available inhovertemplate
are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that arearrayOk: true
) are available. variablesz
,color
andcolormodel
. Anything contained in tag<extra>
is displayed in the secondary box, for example “{fullData.name} ”. To hide the secondary box completely, use an empty tag<extra></extra>
.Declaration
Swift
public var hoverTemplate: Data<String>?
-
Sets a reference between this trace’s x coordinates and a 2D cartesian x axis.
If x (the default value), the x coordinates refer to
layout.xaxis
. If x2, the x coordinates refer tolayout.xaxis2
, and so on.Declaration
Swift
public var xAxis: XAxis
-
Sets a reference between this trace’s y coordinates and a 2D cartesian y axis.
If y (the default value), the y coordinates refer to
layout.yaxis
. If y2, the y coordinates refer tolayout.yaxis2
, and so on.Declaration
Swift
public var yAxis: YAxis
-
Creates
Image
object from the most frequently used properties.Declaration
Parameters
name
Sets the trace name.
z
A 2-dimensional array in which each element is an array of 3 or 4 numbers representing a color.
text
Sets the text elements associated with each z value.
hoverText
Same as
text
. -
init(visible:
opacity: name: uid: ids: customData: meta: hoverLabel: stream: uiRevision: source: z: colorModel: zMin: zMax: x0: y0: dx: dy: text: hoverText: hoverInfo: hoverTemplate: xAxis: yAxis: ) Creates
Image
object with specified properties.Declaration
Swift
public init(visible: Visible? = nil, opacity: Double? = nil, name: String? = nil, uid: String? = nil, ids: [String]? = nil, customData: [String]? = nil, meta: Data<Anything>? = nil, hoverLabel: HoverLabel? = nil, stream: Stream? = nil, uiRevision: Anything? = nil, source: String? = nil, z: ZData? = nil, colorModel: ColorModel? = nil, zMin: InfoArray? = nil, zMax: InfoArray? = nil, x0: Anything? = nil, y0: Anything? = nil, dx: Double? = nil, dy: Double? = nil, text: Data<String>? = nil, hoverText: Data<String>? = nil, hoverInfo: HoverInfo? = nil, hoverTemplate: Data<String>? = nil, xAxis: XAxis = .preset, yAxis: YAxis = .preset)
Parameters
visible
Determines whether or not this trace is visible.
opacity
Sets the opacity of the trace.
name
Sets the trace name.
uid
Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.
ids
Assigns id labels to each datum.
customData
Assigns extra data each datum.
meta
Assigns extra meta information associated with this trace that can be used in various text attributes.
hoverLabel
stream
uiRevision
Controls persistence of some user-driven changes to the trace:
constraintrange
inparcoords
traces, as well as someeditable: true
modifications such asname
andcolorbar.title
.source
Specifies the data URI of the image to be visualized.
z
A 2-dimensional array in which each element is an array of 3 or 4 numbers representing a color.
colorModel
Color model used to map the numerical color components described in
z
into colors.zMin
Array defining the lower bound for each color component.
zMax
Array defining the higher bound for each color component.
x0
Set the image’s x position.
y0
Set the image’s y position.
dx
Set the pixel’s horizontal size.
dy
Set the pixel’s vertical size
text
Sets the text elements associated with each z value.
hoverText
Same as
text
.hoverInfo
Determines which trace information appear on hover.
hoverTemplate
Template string used for rendering the information that appear on hover box.
xAxis
Sets a reference between this trace’s x coordinates and a 2D cartesian x axis.
yAxis
Sets a reference between this trace’s y coordinates and a 2D cartesian y axis.
-
Encodes the object in a format compatible with Plotly.
Declaration
Swift
public func encode(to encoder: Encoder) throws