mat2ds
D = mat2ds(mat [,txt]; x=nothing, text=nothing, multi=false, geom=0, kwargs...)
Take a 2D mat
array and convert it into a GMTdataset. x
is an optional coordinates vector (must have the same number of elements as rows in mat
). Use x=:ny
to generate a coords array 1:n_rows of mat
. Alternatively, if mat
is a string or vector of strings we return a dataset with NaN's in the place of the coordinates. This form is useful to pass to text
when using the region_justify
option that does not need explicit coordinates to place the text.
txt
: Return a Text record which is a GMTdataset with data = Mx2 and text in third column. Thetext
can be an array with same size asmat
rows or a string (will be repeated n_rows times.)
x
: An optional vector with the xx coordinates
hdr
: optional String vector with either one or n_rows multi-segment headers.
lc
orlinecolor
orcolor
: optional array of strings/symbols with color names/values. Its length can be smaller than n_cols, case in which colors will be cycled. Ifcolor
is not an array of strings, e.g.color="yes"
, the colors cycle trough a pre-defined set of colors (same colors as in Matlab). If you want the same color repeated for many lines pass color as a vector. e.g,color=[color]
linethick
orlt
: for selecting different line thicknesses. Works likecolor
, but should be a vector of numbers, or just a single number that is then applied to all lines.
fill
: Optional string array (or a String of comma separated color names, or a Tuple of color names) with color names or array of "patterns".
fillalpha
: Whenfill
option is used, we can set the transparency of filled polygons with this option that takes in an array (vec or 1-row matrix) with numeric values between [0-1] or ]1-100], where 100 (or 1) means full transparency.
is3D
: If input 'mat' contains at least x,y,z (?).
ls
orlinestyle
: Line style. A string or an array of strings withlength = size(mat,2)
with line styles.
front
: Front Line style. A string or an array of strings withlength = size(mat,2)
with front line styles.
pen
: A full pen setting. A string or an array of strings withlength = size(mat,2)
with pen settings. This differs fromlt
in the sense thatlt
does not directly set the line thickness.
multi
ormulticol
: When number of columns inmat
> 2, or == 2 and x != nothing, make an multisegment Dataset with first column and 2, first and 3, etc. Convenient when want to plot a matrix where each column is a line.
segnan
ornanseg
: Boolean. If true, make a multi-segment made out of segments separated by NaNs.
datatype
: Keep the original data type ofmat
. Default converts to Float64.
geom
: The data geometry. By default, we setwkbUnknown
but try to do some basic guess.
proj
orproj4
: A proj4 string for dataset CRS (Coordinate Reference System).
wkt
: A WKT (Well Known Text) CRS.
colnames
: Optional string vector with names for each column ofmat
.
attrib
: Optional dictionary{String, String} with attributes of this dataset.
ref:
Pass in a reference GMTdataset from which we'll take the georeference info as well asattrib
andcolnames
txtcol
ortextcol
: Vector{String} with text to add into the .text field. Warning: no testing is done to check iflength(txtcol) == size(mat,1)
as it must.
D = mat2ds(mat::Array{T,N}, D::GMTdataset)
Take a 2D mat
array and convert it into a GMTdataset. Pass in a reference GMTdataset from which we'll take the georeference info as well as attrib
and colnames
.
D = mat2ds(mat::Vector{<:AbstractMatrix}; hdr=String[], kwargs...)::Vector{GMTdataset}
Create a multi-segment GMTdataset (a vector of GMTdataset) from matrices passed in a vector-of-matrices mat
. The matrices elements of mat
do not need to have the same number of rows. Think on this as specifying groups of lines/points each sharing the same settings. KWarg options of this form are more limited in number than in the general case, but can take the form of a Vector{Vector}, Vector or scalars. In the former case (Vector{Vector}) the length of each Vector[i] must equal to the number of rows of each mat[i].
hdr
: optional String vector with either one orlength(mat)
multi-segment headers.
pen
: A full pen setting. A string or an array of strings withlength = length(mat)
with pen settings.
lc
orlinecolor
orcolor
: optional color or array of strings/symbols with color names/values.
linethick
orlt
: for selecting different line thicknesses. Works likecolor
, but should be a vector of numbers, or just a single number that is then applied to all lines.
ls
orlinestyle
: Line style. A string or an array of strings withlength = length(mat)
with line styles.
front
: Front Line style. A string or an array of strings withlength = length(mat)
with front line styles.
fill
: Optional string array (or a String of comma separated color names, or a Tuple of color names) with color names or array of "patterns".
fillalpha
: Whenfill
option is used, we can set the transparency of filled polygons or symbols with this option that takes in an array (vec or 1-row matrix) with numeric values between [0-1] or ]1-100], where 100 (or 1) means full transparency.
D = mat2ds(D::GMTdataset, inds::Tuple)::GMTdataset
Cut a GMTdataset D with the indices in INDS but updating the colnames and the Timecol info. INDS is a Tuple of 2 with ranges in rows and columns. Ex: (:, 1:3) or (:, [1,4,7]), etc... Attention, if original had attributes other than 'Timeinfo' there is no guarentie that they remain correct.
Example
Create a 3 elements vector with a color and transparency each.
using GMT
D = mat2ds([rand(6,3), rand(4,3), rand(3,3)], fill=[[:red], [:green], [:blue]], fillalpha=[0.5,0.7,0.8]);
# Now see it
viz(D)
See Also
These docs were autogenerated using GMT: v1.11.0