*! version 2.0 09jun2015

Title

asciiplot -- Generate ASCII character map

Syntax

asciiplot [ , scatter_options]

Main
scatter_options Modifications to character map appearance

Description

asciiplot creates a graph with a character map showing the
decimal codes for plain ASCII and extended ASCII characters. With Stata before
version 14, it uses the operating system's extended ASCII character encoding;
with Stata version 14+, it uses Unicode encoding. The graph can be used to
identify quickly the ASCII code of a symbol or nonstandard character which you
want to insert into a graph or SMCL text.

Options

scatter_options are options of
twoway scatter.

Examples

asciiplot

asciiplot , scheme(lean1) saving(ascii.gph)

We want to include the name of the Icelandic parliament, the
"Alþing", in a graph title. Use the character map graph to identify the
code for the Icelandic character þ (thorn, pronounced like th in
"thing"). On a computer with Western European encoding, the ASCII code is
254; this is also the Unicode code. Here are four ways to enter this
character in a graph text:

Method 1: (Windows only) Press the
Alt key while entering on the numeric keypad the 4-digit code, including
leading zeros. Alt+0254 inserts þ:

. graph_command , title("Alþing meetings") ...

Method 2: Enter one of these commands in the Command window:

. display char(254) (Stata <14)

. display uchar(254) (Stata 14+)

Next, copy-and-paste þ from the Results window
to the graph command:

. graph_command , title("Alþing meetings") ...

Method 3: Use the {char # } or
{c # } SMCL directive:

. graph_command , title("Al{c 254}ing meetings") ...

Method 4: Use the char(#) or uchar(#) function to
assign the symbol to a local macro which is then referenced in a subsequent
graph command:

. local th = char(254) (Stata <14)

. local th = uchar(254) (Stata 14+)

. graph_command , title("Al`th'ing meetings") ...

Alternatives

The help for smcl describes how to insert some Western European
characters in graphs and other SMCL text without using the extended ASCII or
Unicode code. For example, you can generate the letter Æ with
{c AE }, the letter ç with
{c c, }, and the Euro symbol with
{c C= }. However, the list of characters is limited,
and nonstandard characters used in other than Western European languages are not
included.

The help for graph text describes SMCL tags for Greek
characters and for some other symbols and characters. To write a Greek
sigma, enter {&sigma}. To write a capital sigma, enter
{&Sigma}.

The user-written grtext command requires Stata 14+. It helps inserting
Unicode characters beyond those displayed by asciiplot. Install it by:

. ssc install grtext

Remarks

Prior to version 14, Stata used ASCII encoding of characters. The
codes for plain ASCII are 33-127; for extended ASCII they are 128-255. There
are several extended ASCII encoding schemes, for example, Latin 1 and
Windows-1252 for Western European Languages, Latin 2 for some Central
and Eastern European languages, and Latin 4 using the Cyrillic
alphabet. Thus, the same extended ASCII code may display different characters
by computers using different encoding schemes.

From version 14, Stata uses Unicode encoding of characters. This
gives access to thousands of characters and symbols, including Arabic,
Cyrillic, Chinese, and other alphabets. The Unicode code point is the number
we use with uchar(#) and other functions, but behind it is a more complex
encoding (UTF-8) where each character is defined by one to four 8-bit bytes. For
the characters represented in plain ASCII and in the Latin 1 extended ASCII
encoding, the Unicode code point is the same as the ASCII code.

Authors

Michael Blasnik

michael.blasnik@verizon.net

Svend Juul

Aarhus University

sj@ph.au.dk

Nicholas J. Cox

Durham University

n.j.cox@durham.ac.uk

Michael Blasnik developed the original idea of the graph. Svend Juul
provided some design suggestions, and Nick Cox wrote the initial ado
file. Svend Juul developed version 2 of the command which works both with Stata
14+ and earlier Stata versions.

Also see

help for graph_text

help for smcl

help for char()

help for uchar() (Stata 14+ only)

help for unicode (Stata 14+ only)