Displays a matrix as a heatmap, or an RGB/RGBA array as an image, like
plotly.py's px.imshow(). Higher-dimensional arrays can be split into
facets and animation frames with facet_col, facet_row and
animation_frame.
Usage
px_imshow(
img,
zmin = NULL,
zmax = NULL,
origin = NULL,
labels = list(),
x = NULL,
y = NULL,
animation_frame = NULL,
facet_col = NULL,
facet_row = NULL,
facet_col_wrap = NULL,
facet_col_spacing = NULL,
facet_row_spacing = NULL,
color_continuous_scale = NULL,
color_continuous_midpoint = NULL,
range_color = NULL,
title = NULL,
template = NULL,
width = NULL,
height = NULL,
aspect = NULL,
contrast_rescaling = NULL,
binary_string = NULL,
binary_backend = "auto",
binary_compression_level = 4,
binary_format = "png",
text_auto = FALSE
)Arguments
- img
The image: a numeric or logical matrix (shown as a heatmap with a continuous color scale), a data.frame (its column and row names give
xandy), or an array of dimensionc(height, width, 3)(RGB) orc(height, width, 4)(RGBA) shown as an image. Raw vectors and integer arrays with values 0-255 are treated as 8-bit images; numeric images are scaled according to their range (e.g. 0-1 forpng::readPNG()output). Withfacet_col,facet_roworanimation_frame, one more dimension per argument.- zmin, zmax
Minimum and maximum of the color range (per channel for RGB(A) images: a single value, or 1, 3 or 4 values).
- origin
"upper"(default, row 1 at the top) or"lower".- labels
Named list overriding the labels of
x,y,color,facet_col,facet_rowandanimation_frame.- x, y
Coordinates of the columns and rows (numeric for RGB images).
- animation_frame, facet_col, facet_row
Dimension of
img(a number, or a name innames(dimnames(img))) to split into animation frames, facet columns or facet rows.- facet_col_wrap
Maximum number of facet columns.
- facet_col_spacing, facet_row_spacing
Spacing between facets, as a fraction of the figure.
- color_continuous_scale, color_continuous_midpoint, range_color
Color scale settings for single-channel images (see px_args).
- title, template, width, height
See px_args.
- aspect
"equal"(default for arrays; square pixels) or"auto"(fill the figure).- contrast_rescaling
"minmax"(scale to the data range; default for single-channel images) or"infer"(scale to the range implied by the data type).- binary_string
If
TRUE, RGB(A) images are sent as a compressed PNG (needs the png package) instead of an array of values; the default when png is installed.- binary_backend, binary_compression_level
Unused; accepted for compatibility with plotly.py.
- binary_format
Only
"png"is supported.- text_auto
If
TRUEor a d3-format string, show the values as text on heatmaps.
Value
A go_figure().
See also
Other plotly express:
px_area(),
px_bar(),
px_bar_polar(),
px_box(),
px_choropleth(),
px_choropleth_map(),
px_density_contour(),
px_density_heatmap(),
px_density_map(),
px_ecdf(),
px_funnel(),
px_funnel_area(),
px_histogram(),
px_icicle(),
px_line(),
px_line_3d(),
px_line_geo(),
px_line_map(),
px_line_polar(),
px_line_ternary(),
px_parallel_categories(),
px_parallel_coordinates(),
px_pie(),
px_scatter(),
px_scatter_3d(),
px_scatter_geo(),
px_scatter_map(),
px_scatter_matrix(),
px_scatter_polar(),
px_scatter_ternary(),
px_strip(),
px_sunburst(),
px_timeline(),
px_treemap(),
px_violin()