GithubHelp home page GithubHelp logo

wangtaoqd1987 / awesome-latex-drawing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xinychen/awesome-latex-drawing

0.0 0.0 0.0 13.99 MB

Drawing Bayesian networks, graphical models, tensors, and technical frameworks and illustrations in LaTeX.

License: MIT License

TeX 100.00%

awesome-latex-drawing's Introduction

Awesome LaTeX drawing

MIT License repo size GitHub stars

Made by Xinyu Chen • 🌐 https://xinychen.github.io

awesome-latex-drawing is a collection of 20+ academic drawing examples for using LaTeX, including Bayesian networks, function plotting, graphical models, tensor structure, and technical frameworks. [Blog post on Medium]

Description

LaTeX is a high-quality typesetting system, and it is available as a free software. In recent years, it is very popular for creating and drawing academic graphics by using LaTeX. This is because that LaTeX is able to draw many complicated graphics containing special symbols and math equations. It is really a great attempt for using LaTeX to draw certain graphics in your research.This post will introduce some graphics that created by using LaTeX. It would be easy to follow the examples with a popular online LaTeX system - Overleaf. If you are interested, welcome to use Overleaf and reproduce our examples. The Overleaf is available at overleaf.com, please feel free to try it.

Contents

Table of Examples


Usage

Open overleaf.com in your Chrome.

It is not necessary to open each file in this repository because you can just follow this readme document.


Gallery

Looking for some good LaTeX drawing examples? Here is a few (20+) to peruse.


Bayesian Networks

LaTeX provides some powerful domain-specific packages and tools like tikz to enable flexible graphical models. Bayesian networks represent a family of graphical models consisting of variables (usually denoted by nodes) and dependency relationships (usually denoted by arrows). Fortunately, tikz has a specific library for drawing Bayesian networks and directed factor graphs.

Bayesian Tensor Factorization

[Example 1]

This example is from the following paper:

drawing which shows the Bayesian network of Bayesian CP factorization (BCPF) model. To draw this Bayesian network example, there are some preliminaries to follow:
  • preamble codes:
    1. define the documentclass as standalone, e.g., \documentclass[border = 0.1cm]{standalone} with 0.1cm border,
    2. use package tikz in preamble, i.e., \usepackage{tikz}, and use tikz library like \usetikzlibrary{bayesnet} which is an important tool for drawing Bayesian networks and directed factor graphs,
    3. set the tikz style by using the \tikzstyle{} command,
    4. use math equation environments including \usepackage{amsfonts, amsmath, amssymb}.
  • body codes:
    1. use \begin{tikzpicture} \end{tikzpicture} to start drawing,
    2. use \node to define nodes and text boxes in the Bayesian network,
    3. use \path to define arrows in the Bayesian network,
    4. use \plate to define plates in the Bayesian network.

Please click on the image and check out the source code.


[Example 2]

This example is from the following paper:

Xinyu Chen, Zhaocheng He, Lijun Sun (2019). A Bayesian tensor decomposition approach for spatiotemporal traffic data imputation. Transportation Research Part C: Emerging Technologies, 98: 73-84.

drawing which shows the Bayesian network of Bayesian Gaussian CP factorization (BGCP) model. To draw this Bayesian network example, there are some preliminaries to follow:
  • preamble codes:
    1. define the documentclass as standalone, e.g., \documentclass[border = 0.1cm]{standalone} with 0.1cm border,
    2. use package tikz in preamble, i.e., \usepackage{tikz}, and use tikz library like \usetikzlibrary{bayesnet} which is an important tool for drawing Bayesian networks and directed factor graph,
    3. set the tikz style by using the \tikzstyle{} command,
    4. use math equation environments including \usepackage{amsmath, amsfonts, amssymb}.
  • body codes:
    1. use \begin{tikzpicture} \end{tikzpicture} to start drawing,
    2. use \node to define nodes and text boxes in the Bayesian network,
    3. use \path to define arrows in the Bayesian network,
    4. use \plate to define plates in the Bayesian network.

Please click on the image and check out the source code. If you are interested in the original Bayesian network of BGCP in the paper, please check out BGCP.tex.


[Example 3]

This example is from the following paper:

Xinyu Chen, Zhaocheng He, Yixian Chen, Yuhuan Lu, Jiawei Wang (2019). Missing traffic data imputation and pattern discovery with a Bayesian augmented tensor factorization model. Transportation Research Part C: Emerging Technologies, 104: 66-77.

drawing which shows the Bayesian network of Bayesian augmented tensor factorization (BATF) model. To draw this Bayesian network example, there are some preliminaries to follow:
  • preamble codes:
    1. define the documentclass as standalone, e.g., \documentclass[border = 0.1cm]{standalone} with 0.1cm border,
    2. use package tikz in preamble, i.e., \usepackage{tikz}, and use tikz library like \usetikzlibrary{bayesnet} which is an important tool for drawing Bayesian networks and directed factor graph,
    3. set the tikz style by using the \tikzstyle{} command,
    4. use math equation environments including \usepackage{amsmath, amsfonts, amssymb}.
  • body codes:
    1. use \begin{tikzpicture} \end{tikzpicture} to start drawing,
    2. use \node to define nodes and text boxes in the Bayesian network,
    3. use \path to define arrows in the Bayesian network,
    4. use \plate to define plates in the Bayesian network.

Please click on the image and check out the source code.


This example is from the following paper:

Xinyu Chen, Lijun Sun (2021). Bayesian temporal factorization for multidimensional time series prediction. IEEE Transactions on Pattern Analysis and Machine Intelligence. (Early access)

drawing which shows the Bayesian network of Bayesian temporal matrix factorization (BTMF) model. To draw this Bayesian network example, there are some preliminaries to follow:
  • preamble codes:
    1. define the documentclass as standalone, e.g., \documentclass[border = 0.1cm]{standalone} with 0.1cm border,
    2. use package tikz in preamble, i.e., \usepackage{tikz}, and use tikz library like \usetikzlibrary{bayesnet} which is an important tool for drawing Bayesian networks and directed factor graph,
    3. set the tikz style by using the \tikzstyle{} command,
    4. use math equation environments including \usepackage{amsmath, amsfonts, amssymb}.
  • body codes:
    1. use \begin{tikzpicture} \end{tikzpicture} to start drawing,
    2. use \node to define nodes and text boxes in the Bayesian network,
    3. use \path to define arrows in the Bayesian network,
    4. use \plate to define plates in the Bayesian network.

Please click on the image and check out the source code. Instead of multivariate vector autoregressive process on temporal factors, we can also use univariate autoregressive process to rebuild BTMF. The Beyasian network is available at btmf_net.png, you can also check out the source code btmf_net.tex.


pgfplots function plotting

[Example 5]

drawing drawing

These two examples show the probability density function (PDF) and cumulative density function (CDF) of Erlang distribution, respectively. To draw the example, there are few steps to follow:


  • preamble codes:
    1. define the documentclass as standalone,
    2. use package pgfplots in preamble,
    3. set font style and adjust \pgfplotsset{} as you prefer.
  • body codes:
    1. use \begin{tikzpicture} \end{tikzpicture} to start drawing,
    2. use \begin{axis} \end{axis} to draw the function,
    3. use \addplot to define the function for drawing.

[Example 6]
drawing

This example shows the PDF of normal distribution with different means and variances. To draw this example, there are few step to follow:



[Example 7]

drawing drawing

These two examples show the PDF and joint PDF of Lognormal distributions, respectively. There are some recommended material to follow the examples:



[Example 8]

drawing

This example shows four sequences consisting of Sine and Cosine functions. When regarding these sequences as time series, then we can see two kinds of temporal dynamics, that is, one is from Sine function, while another is from Cosine function. To draw this example, we can follow these steps:


  • preamble codes:
    1. define the documentclass as standalone,
    2. use package pgfplots in preamble,
    3. set font style and adjust \pgfplotsset{} as you prefer.
  • body codes:
    1. use \pgfmathdeclarefunction to define the PDF function of normal (Gaussian) distribution,
    2. use \begin{tikzpicture} \end{tikzpicture} to start drawing,
    3. use \begin{axis} \end{axis} to draw the function,
    4. use \addplot to define the function for drawing.

[Example 9]

This example illustrates the mechanism of time series forecasting on streaming data in our tracebase project. To draw this example, we can follow these steps:

drawing
  • preamble condes:
    1. define the documentclass as standalone,
    2. use both tikz and pgfplots packages in preamble,
    3. set font style and adjust \pgfplotsset{} as you prefer.
  • body codes:
    1. use \begin{tikzpicture} \end{tikzpicture} to start drawing,
    2. use \begin{axis} \end{axis} to define the graphic,
    3. use addplot to define the marks at some coordinates and specify the color of these marks.

Research Frameworks

in your overleaf project, then you will see the following picture:

drawing

Figure 7: Tensor completion task and its framework including data organization and tensor completion, in which traffic measurements are partially observed.

drawing

Figure 8: A graphical illustration of rolling prediction strategy with temporal matrix factorization and autoregressive model.

drawing

Figure 9: A graphical illustration of rolling prediction strategy with temporal matrix factorization and vector autoregressive model.

drawing

Figure 10: A graphical illustration of the partially observed time series data.

drawing

Figure 11: A graphical illustration of the partially observed time series tensor.

drawing

Figure 12: Multivariate time series data prediction with missing values.

drawing

Figure 13: Tensor time series data prediction with missing values.

  • Open mf-explained.tex in your overleaf project, then you will see the following picture:

drawing

Figure 14: A graphical illustration of matrix factorization.

in your overleaf project, then you will see the following picture:

drawing

Figure 15: A graphical illustration of low-rank tensor completion model.

  • Open latc_framework in your overleaf project, then you will see the following picture:

drawing

Figure 16: A graphical illustration of low-rank autoregressive tensor completion model.

Tensor Factorization

  • Open tensor.tex in your overleaf project, then you will see the following picture:

drawing

Figure 17: A graphical illustration for the (origin,destination,time slot) tensor.

  • Open AuTF.tex in your overleaf project, then you will see the following picture:

drawing

Figure 18: Augmented tensor factorization (AuTF) model.

  • Open TVART.tex in your overleaf project, then you will see the following picture:

drawing

Figure 19: Tensor regression model.

  • Open tensor_svt.tex in your overleaf project, then you will see the following picture:

drawing

Figure 20: Singular value thresholding process of the tensor data with unitary transform.

drawing

Figure 21: Illustration of CP factorization on third-order tensor.

Data Visualization

  • Open RMseries.tex in your overleaf project, then you will see the following picture:

drawing

Figure 22: Random missing pattern.

  • Open NMseries.tex in your overleaf project, then you will see the following picture:

drawing

Figure 23: Non-random missing pattern.

in your overleaf project, then you will see the following picture:

drawing

Figure 24: Imputation performance.

If you want to draw each sub-figure, please check out the following .tex files:

Awesome Stuff

in your overleaf project, then, you will see the following picture:

drawing

Figure 25: transdim logo.

Recommended Posts

  1. draw colored world/US map in LaTeX
  2. geographic maps with TikZ/pgfplots

More Features

Coming soon...

Related Projects

Publications

Most of these examples are from our papers:

  • Xinyu Chen, Mengying Lei, Nicolas Saunier, Lijun Sun (2021). Low-rank autoregressive tensor completion for spatiotemporal traffic data imputation. IEEE Transactions on Intelligent Transportation Systems. [Preprint] [DOI] [Data & Python code] (Also accepted in part to MiLeTS Workshop of KDD 2021, see workshop paper)

  • Xinyu Chen, Yixian Chen, Nicolas Saunier, Lijun Sun (2021). Scalable low-rank tensor learning for spatiotemporal traffic data imputation. Transportation Research Part C: Emerging Technologies, 129: 103226. [Preprint] [DOI] [Data] [Python code]

  • Xinyu Chen, Lijun Sun (2021). Bayesian temporal factorization for multidimensional time series prediction. IEEE Transactions on Pattern Analysis and Machine Intelligence. (Early access) [Preprint] [DOI] [Slides] [Data & Python code]

  • Xinyu Chen, Lijun Sun (2020). Low-rank autoregressive tensor completion for multivariate time series forecasting. arXiv: 2006.10436. [Preprint] [Data & Python code]

  • Xinyu Chen, Jinming Yang, Lijun Sun (2020). A nonconvex low-rank tensor completion model for spatiotemporal traffic data imputation. Transportation Research Part C: Emerging Technologies, 117: 102673. [Preprint] [DOI] [Data & Python code]

  • Xinyu Chen, Zhaocheng He, Yixian Chen, Yuhuan Lu, Jiawei Wang (2019). Missing traffic data imputation and pattern discovery with a Bayesian augmented tensor factorization model. Transportation Research Part C: Emerging Technologies, 104: 66-77. [DOI] [Slides] [Data] [Matlab code] [Python code]

  • Xinyu Chen, Zhaocheng He, Lijun Sun (2019). A Bayesian tensor decomposition approach for spatiotemporal traffic data imputation. Transportation Research Part C: Emerging Technologies, 98: 73-84. [Preprint] [DOI] [Data] [Matlab code] [Python code]

Please cite our papers if you find these codes help your research.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.