Senin, 25 November 2024

Draw A Cartesian Coordinate In Latex 2

  • Open the Latex editor
  • Type this following latex code in your Latex editor:
    % !TEX TS-program=pdflatex
    % !TEX encoding=utf-8
    \documentclass[12pt,titlepage]{report}
    % Loading the package
    %---------------------------
    \usepackage[utf8]{inputenc}
    \usepackage{amsmath}
    \usepackage{amsfonts}
    \usepackage{amssymb}
    \usepackage{fouriernc}
    \usepackage{bm}
    \usepackage{tikz}
    \usepackage{xcolor}
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.18}
    \usepackage[active,tightpage,pdftex]{preview}
    \PreviewEnvironment[{[]}]{tikzpicture}
    \setlength\PreviewBorder{0.25pt}
    %---------------------------

    \author{private course and after school tutor}


    \begin{document}
    % -------------------
    % step 2
    % -------------------
    \begin{figure}
    \begin{tikzpicture}%[->]
    %draw gridline
    \draw[help lines,opacity=.25] (-5,-5) grid (5,5);

    % -------------------
    %draw 0,0 node
    % -------------------
    \draw (0,0) node [anchor=north east, font=\bfseries] {$0$};

    % -------------------
    % draw axes line
    % -------------------
    \draw[-latex,thick,font=\bfseries] (-4.5,0) -- (4.5,0) node [anchor=north] {\large{$\mathsf{sumbu\ x}$}};
    \draw[-latex,thick] (0,-4) -- (0,4) node [anchor=west] {\large{$\mathsf{sumbu\ y}$}};

    % -------------------
    % draw coordinate plane quadrant 1
    % -------------------
    \boldmath

    \path[draw=black, ultra thick, text=black] (1,2) node[anchor=south west, font=\bfseries] {Quadrant I};
    \path[draw=black, ultra thick, text=black] (1,1.5) node[anchor=south west, font=\bfseries] {(+,\ +)};

    % -------------------
    % draw coordinate plane quadrant 2
    % -------------------
    \path[draw=black, ultra thick, text=black] (-3.8,2) node[anchor=south west, font=\bfseries] {Quadrant II};
    \path[draw=black, ultra thick, text=black] (-3.8,1.5) node[anchor=south west, font=\bfseries] {($\mathbf{-}$,\ +)};

    % -------------------
    % draw coordinate plane quadrant 3
    % -------------------
    \path[draw=black, ultra thick, text=black] (-4,-2) node[anchor=south west, font=\bfseries] {Quadrant III};
    \path[draw=black, ultra thick, text=black] (-4,-2.5) node[anchor=south west, font=\bfseries] {($\mathbf{-,\ -}$)};

    % -------------------
    % draw coordinate plane quadrant 4
    % -------------------
    \path[draw=black, ultra thick, text=black] (1,-2) node[anchor=south west, font=\bfseries] {Quadrant IV};
    \path[draw=black, ultra thick, text=black] (1,-2.5) node[anchor=south west, font=\bfseries] {($\mathbf{+,\ -}$)};

    % -------------------
    % draw axes label
    % label 1 (horizontal right), label 2 (horizontal left), label 3 (vertical up), label 4 (vertical down)
    % -------------------
    \foreach \i in {1, ..., 3} \draw(\i,2.5pt) -- +(0,-5pt) node [anchor=north, font=\bfseries] {\large{$\mathrm{\i}$}} (-\i,2.5pt) -- +(0,-5pt) node [anchor=north, font=\bfseries,fill=white] {\large{$\mathrm{-\i}$}} (2.5pt,\i) -- + (-5pt,0) node [anchor=east, font=\bfseries] {\large{$\mathrm{\i}$}} (2.5pt,-\i) -- + (-5pt,0) node [anchor=east, font=\bfseries, fill=white] {\large{$\mathrm{-\i}$}};
    \end{tikzpicture}
    \end{figure}
    \end{document}


  • save file as koordinatKartesius2.tex
  • Typeset or Build.
  • Output

    Notes To see the more clear picture, click on the picture.



    Related Post

Tidak ada komentar:

Posting Komentar