One of the most frequent topics of user queries I am getting are legends. So let's explain some of the principles here.
As you know, in GCDkit it is possible to assign plotting symbols and/or colours by several mechanisms, and these, in turn, influence the appearance of the resulting legend(s).
Plotting symbols and colours set from Plot settings menu
The easiest way to alter the plotting symbols and/or colours is to use the Plot settings menu.
They can be chosen by the following mechanisms:levels of the chosen label
- according to all unique values attained by the given textual field, such as locality names or names of igneous suites
- menus Plot settings|Symbols by label, Plot settings|Symbols by label - initial letters and Plot settings|Colours by label
- functions assignSymbLab(), assignSymbLett() and assignSymbCol()
uniform symbols or colours
- the symbol or colour will be the same for all samples
- menus Plot settings|Uniform symbols and Plot settings|Uniform colours
- functions assign1symb() and assign1col()
colours by variable
- plotting colours assigned according to the values of the given variable, the chosen palette and desired approximate number of its shades
- menu Plot settings|Colours by variable
- function assignColVar()
symbols/colours by group
- according to the levels
of the currently defined groups.
NB that these have to be defined previously either from menu Plot settings|Data handling|Set groups by... (label, numeric variable, diagram, outline or cluster analysis) or by one of the underlying functions: groupsByLabel(), cutMy(), groupsByDiagram(), figGbo() or groupsByCluster() - menu Plot settings|Symbols/colours by groups
- function assignSymbGroup()
- according to the levels
of the currently defined groups.
Setting up a legend
In all these cases, the legend is prepared automatically and invisibly by the GCDkit system. If contrasting criteria are chosen for symbols and colours, two legends are built.Here comes a bit more technical description - for definition of legends, two internal variables '
leg.col
' and 'leg.pch
', are used. If they differ from each other, two separate legends are created, for plotting symbols and colours. If both variables equal
zero, the current grouping information is used.
Otherwise these variables contain
the sequential number(s) of column(s) in the data frame 'labels
', whose
levels are to be used to build the legend(s).Lastly, I should point out that the legend is still not correctly built when the colours are assigned by a numeric variable - a shortcoming that is fixed by the new version of GCDkit that is currently at advanced stages of preparation.
Plotting symbols and colours set directly in the datafile
File structure
Already the data files may contain specifications of plotting symbols and/or colours in columns named "Symbol" and "Colour" or “Color”, respectively.
The plotting symbols can be specified either as single
character strings or numeric codes, whose overview can be
obtained by invoking the menu item Plot settings|Show available symbols.
The colours are coded either as numeric values (1–49) or one of 657 full English (British or US spelling) names. For further information, see Help, the menu Plot settings|Show available colours or type colours() into the Console.
Loading the file
If specifications of both the plotting symbols and colours are absent, and at least one non-numeric variable is present, the user is prompted upon loading a new datafile whether he does want to have the symbols and colours assigned automatically, according to the levels of the selected label. Otherwise default symbols (empty black circles) are used.