Monday, 17 April 2017

Legendary post

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:
  1. 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()
  2. 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()
  3.  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()

  4.  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()

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 "Symboland "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. 

Setting up a legend

After the data are successfully loaded, the logic that is behind the user's choice of plotting symbols and colours predefined in the file needs to be explained to the GCDkit system. This is done from the menu Plot settings using one of the four mechanisms discussed above. Perhaps the most common is a scenario in which the symbols, colours, or both, reflect levels of a single label, for instance the names of individual intrusions.

And, finally.... displaying a legend

Apart from diagrams that contain legends automatically, such as spiderplots, there are two possibilities how to display legend(s). First shows legend in a standalone window, invoking the menu Plot settings|Display legend attached to the function showLegend().  The second adds legend to an existing Figaro compatible plot, using the  menu Plot editing|Add... legend or the function figLegend(). In the latter case, the user has to click on the position of the top left corner for positioning of the legend box.
 

2 comments:

  1. You may not know that some apps can spy on your cell phone without you being aware of it. This form of spying is called cell phone tracking software. There is cell phone tracking software that can be installed on your cell phone and it's impossible to detect. If you want to know how to tell if your cell phone is being tracked, keep reading.

    ReplyDelete
  2. If you are looking for a way to bypass iPhone passcode in a safe and efficient manner, then there are many different ways that you can do this. This process requires an iPhone and a computer that is running Mac OS X. You will need to download a program called iPhone Backup Extractor on your computer to complete this process.

    ReplyDelete