This repository shares TikZ and PGF coding (written by Ian He and JaeSeok Oh) to create plots in LaTeX. To see the coding for any plot in the following sections, please click the figure. The hyperlink will lead you to our corresponding tex file.
Contact:
🥸 Ian: [email protected].
😎 JaeSeok: [email protected].
Comments are always welcomed!
TikZ and PGF are languages commonly used in LaTeX for producing vector graphics, with lots of wonderful features including the drawing of points, lines, arrows, and shapes. More precisely, PGF is a lower-level language, while TikZ is a set of higher-level macros that use PGF.
To replicate the plots we create in the following sections, you must type the codes below in your LaTeX preamble.
\usepackage{graphicx, float, caption, subcaption, tzplot, asymptote, pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{calc, calligraphy, decorations.pathreplacing, fit, patterns, shadows, shapes.geometric, shapes.misc}
\usepackage{xcolor}
\definecolor{main}{RGB}{0,166,82}
\definecolor{second}{RGB}{32,178,170}
\usepackage{amsmath, amssymb, bbm, dutchcal}Note:
- The
graphicxpackage (documentation) provides some useful optional arguments to the\includegraphicscommand. - The
floatpackage (documentation) improves the interface for defining floating objects, such as figures and tables. By default, we can use something[h](here),t(top), andb(bottom) to determine the figure positioning; however, these positioning options are not strong --- LaTeX still has some flexibility to select the best position in its mind. To precisely fix the position of a floating objects, we have to use the parameter[H]fromfloat. - The
caption(documentation) andsubcaption(documentation) packages allow us to customize the captions and subcaptions in floating environments like figure, table, subfigure, and subtable. - The
tzplotpackage (documentation) provides some TikZ-based macros to make it easy to draw graphs. For example,- The
\tzaxescommand draws the x-axis and the y-axis quickly. - The
\tzfncommand plots a function over a specified domain. - The
\tzbeziercommand draws a Bézier curve with one or two control points from the first coordinate to the last coordinate. - The
\tzdotand\tzcdotcommands add a label to a dot (with two optional patterns and two optional sizes).
- The
- The
asymptotepackage (documentation) provides a lot of commands for 2D and 3D high-quality level technical drawing. - The
pgfplotspackage (documentation) allows us to draw high-quality function plots. In particular, it supports axis scaling, axis ticks custimization, axis labels custimization, legend entries, etc. Note thatpgfplotshas been written with backwards compatibility; thus, new features occasionally lead to a different behavior. Therefore, we suggest to activate explicitly new features or bugfixes by writing\pgfplotsset{compat=1.18}in your preamble, wherecompat=1.18is the highest compatibility level nowadays. The lowest level iscompat=1.3. asymptoteandpgfplotsprovide basic functionalities and load thetikzandpgfpackages (documentation) automatically. For special features, special libraries must be included. The libraries we use includecalc(making complex coordinate calculations);calligraphy(enabling calligraphic style drawings);decorations.pathreplacing(defining decorations that replace the to-be-decorated path by another path);fit(defining options for fitting a node so that it contains a set of coordinates);patterns(providing different patterns for filling in area);shadows(helping add a partly transparent shadow to a path or node);shapes.geometric(defining some shapes such as ellipses and polygons);shapes.misc(defining additional shapes).
- The
xcolorpackage (documentation) allows us to select colors for hyper references, url links, plotting figures, etc. The basic color (e.g., blue and red) can be used directly by typing\color{color_name}to use it in the document. If additional colors are needed, we suggest to name the color first (for convenient future use) by the\definecolor{new_color_name}{RGB}{#,#,#}command, and then use the\color{new_color_name}command. The RGB model is our preferred model, but other models (e.g.,rgb,HTML,HSB, etc.) are also available. There are some good websites to search for color codes: - The
amsmathpackage (documentation) is a principal package for mathematical typesetting. Onceamsmathis loaded, the packagesamsbsy(for bold symbols),amsopn(for operator names) andamstext(for text embedded in mathematics) are also loaded. - The
amssymbpackage provides an extended symbol collection, especially including some additional binary relation symbols (e.g.,\boxdot,\boxplus,\boxtimes). Something noteworthy is that this package provides the\mathbb{ }command for producing blackboard bold characters. - The
bbmpackage (documentation) provides blackboard variants of characters in math mode. The command is\mathbbm{ }, which produces the blackboard bold characters slighly different from those produced by\mathbb{ }. - The
dutchcalpackage (documentation) reworks the mathematical calligraphic font ESSTIX13 in the packageesstix(documentation) and adds a bold version.
/Best_Response_with_Continuous_NE.png)
/Dynamics_of_Solow_Model.png)
/Engel_Function.png)
/Indifference_Curve_1.png)
/Indifference_Curve_2.png)
/Indifference_Curve_3.png)
/Leontief_Production_Function.png)
/Binomial_Distribution_PMF.png)
/Poisson_Distribution_PMF.png)
/t_Distribution_PDF.png)
/Gamma_Distribution_PDF.png)
/Budget_Set.png)
/Input_Requirement_Set.png)
/Welfare_Implication_Monopoly.png)
/Predation_Game_with_Weak_PBE.png)
/Monopoly_Output.png)
/Product_Differentiation.png)