Skip to content

Commit 67ed3e7

Browse files
committed
Add the biplot man.
1 parent 5fd9eca commit 67ed3e7

File tree

2 files changed

+85
-3
lines changed

2 files changed

+85
-3
lines changed

documentation/modules/biplot.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# biplot
2+
3+
```julia
4+
biplot(name::String | D::GMTDataset; arrow::Tuple=(0.3, 0.5, 0.75, "#0072BD"), cmap=:categorical,
5+
colorbar::Bool=true, marker=:point,ms="auto", obsnumbers::Bool=false, PC=(1,2),
6+
varlabels=:yes, xlabel="", ylabel="", kw...)
7+
```
8+
9+
Create a 2D biplot of the Principal Component Analysis (PCA) of a two-dimensional chart that
10+
represents the relationship between the rows and columns of a table.
11+
12+
- `cmd0`: The name of a 2D data table file readable with ``gmtread()``, or a ``GMTdataset`` with the data.
13+
14+
- `arrow`: a tuple with the following values: (len, shape, width, color). If this default is used we scale them by fig size.
15+
- `len`: the length of the arrowhead in cm. Default is 0.3.
16+
- `shape`: the shape of the arrow. Default is 0.5.
17+
- `width`: the width of the arrow stem in points. Default is 0.75.
18+
- `color`: the color of the arrow. Default is "#0072BD".
19+
20+
- `cmap`: a String or Symbol with the name of a GMT colormap.
21+
- Or a string with "matlab" or "distinct"
22+
- Or "alphabet" for colormaps with distinct colors.
23+
- Or a comma separated string with color names; either normal names ("red,green") or hex color codes ("#ff0000,#00ff00").
24+
- Or "none" for plotting all points in black color. A single color in hexadecimal format plots all points in that color.
25+
Default is "categorical".
26+
27+
- `colorbar`: whether to plot a colorbar. Default is true.
28+
29+
- `marker`: a String or Symbol with the name of a GMT marker symbol. Default is "point".
30+
31+
- `ms`: a String or Symbol with the name of a GMT marker size. Default is "auto" (also scales sizes with the size of the plot).
32+
33+
- `obsnumbers`: whether to plot observation numbers on the plot. Default is false. Note that in this case we are not able
34+
to plot colored numbers by category, so we plot the symbols as well (use `cmap="none"` if you don't want this).
35+
36+
- `PC`: a tuple with the principal components to plot. Default is (1, 2). For example, PC=(2,3) plots
37+
the 2nd and 3rd principal components.
38+
39+
- `varlabels`: whether to plot variable labels. The default is :yes and it prints as labels the column names
40+
if the input GMTdataset. Is it hasn't column names, then it prints "A,B,C,...". Give a string vector to plot custom labels.
41+
42+
- `xlabel`: a String with the x-axis label. Default is "", which prints "PC[PC[1]]".
43+
44+
- `ylabel`: a String with the y-axis label. Default is "", which prints "PC[PC[2]]".
45+
46+
- `kw...`: Any additional keyword argument to be passed to the ``plot()`` function.
47+
48+
49+
Examples
50+
--------
51+
52+
See the classic analysis of the _Iris_ dataset.
53+
54+
\begin{examplefig}{}
55+
```julia
56+
using GMT
57+
biplot(TESTSDIR * "iris.dat", show=true)
58+
```
59+
\end{examplefig}
60+
61+
Plot a 6 cm fig with the observarion numbers.
62+
63+
\begin{examplefig}{}
64+
```julia
65+
using GMT
66+
biplot(TESTSDIR * "iris.dat", figsize=6, obsnumbers=true, show=true)
67+
```
68+
\end{examplefig}

documentation/utilities/binarize.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
11
# binarize
22

33
```julia
4-
Ibw = binarize(I::GMTimage, threshold::Int=0; band=1, , threshold::Int=0, revert=false) -> GMTimage
4+
Ibw = binarize(I::GMTimage, threshold::Int=0; band=1, threshold::Int=0, revert=false, bool::Bool=false) -> GMTimage
5+
```
6+
7+
---
8+
or
9+
10+
```julia
11+
Ibw = binarize(I::GMTimage, threshold::Vector{Int}; band::Int=1, revert::Bool=false, bool::Bool=false)
512
```
613

714
Convert an image to a binary image (black-and-white) using a threshold.
815

916
### Args
1017
- `I::GMTimage`: input image of type UInt8.
1118

12-
- `threshold::Int`: A number in the range [0 255]. If the default (0) is kept and the keyword
19+
- `threshold`: A number in the range [0 255]. If the default (0) is kept and the keyword
1320
`threshold` is not used, then the threshold is computed using the \myreflink{isodata} method.
21+
Alternatively, a vector of two numbers in the range [0 255] can be used. In this case, the
22+
threshold is set to the first value and the second value is used to set the upper limit of the
23+
threshold range. That is, values between the two values are set to 255 and the rest to 0
24+
(or `true` and false respectively when the `bool` keyword is set to `true`). Note that with
25+
this second form, the `threshold` keyword does not exist.
1426

1527
### Kwargs
1628
- `band`: If the `I` image has more than one band, use `band` to specify which one to binarize.
1729
By default the first band is used.
1830

31+
- `bool`: If `true`, the output image is of type Bool, otherwise it is of type UInt8.
32+
1933
- `threshold`: Alternative keyword argument to the positional `threshold` argument. Meaning, one can either
2034
use the `binarize(I, ??)` or `binarize(I, threshold=??)`.
2135

22-
- `revert`: If `true`, values below the threshold are set to 255, and values above the threshold are set to 0.
36+
- `revert`: If `true`, values below the threshold are set to 255, and values >= the threshold are set to 0.
2337

2438
### Return
2539
A new \myreflink{GMTimage}.

0 commit comments

Comments
 (0)