1. Type this following Latex source code in Latex editor:
% !TEX ts-program=pdflatex
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
%% for preview only
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}
\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}
\draw[style=help lines,gray!35](0, 0) grid [step={($(0.25, 0.25) - (0, 0)$)}] (4, 4);
%% specifying coordinate
\coordinate (A) at (0,3);
\coordinate (B) at (3,0);
%% Syntax For Specifying Points
%% Syntax For Path Specifications
%% Draw absis and ordinate line;
\draw[-latex, very thick] (-0.2,0) -- (4,0) coordinate (C) node[right] {$x$};
\draw[-latex, very thick] (0,-0.2) -- (0,4) coordinate (D) node[left] {$y$};
%% create a nodes
%% drawing slanted/skew/gradient line
\draw[thick] (0,3) coordinate(A) -- (3,0) coordinate(B);
\draw (A) node {\textbullet};
\draw (A) node[left] {a};
\draw (B) node {\textbullet};
\draw (B) node[below] {b};
Tidak ada komentar:
Posting Komentar