Senin, 24 Februari 2025

Graph Function of Linear Equations in Two Variables Using Latex



1. Type this following latex code in the latex editor:
% !TEX TS-program=pdflatex
% !TEX encoding=UTF-8 Unicode
%
%% File name: GraphLinearEquation2Variables1.tex
%% Document Definitions:
%% LINEAR SYSTEM FUNCTIONS GRAPH With 2 VARIABLES
%%-----------------------------------
%\usepackage{tgbonum}
%\usepackage{arevmath}

\documentclass[tikz,border=5pt]{standalone}
\usepackage{libertine}
\usepackage{tikz}
\usepackage{pgfplots}
%\pgfplotsset{compat=newest}
\pgfplotsset{compat=1.18}
\pgfplotsset{%
    axis line origin/.style args={#1,#2}{
        x filter/.append code={ % Check for empty or filtered out numbers
            \ifx\pgfmathresult\empty\else\pgfmathparse{\pgfmathresult-#1}\fi
        },
        y filter/.append code={
            \ifx\pgfmathresult\empty\else\pgfmathparse{\pgfmathresult-#2}\fi
        },
        xticklabel=\pgfmathparse{\tick+#1}\pgfmathprintnumber{\pgfmathresult},
        yticklabel=\pgfmathparse{\tick+#2}\pgfmathprintnumber{\pgfmathresult}
    }
}

\makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother

\pgfplotsset{
    every tick/.append style={color=black},
    after end axis/.append code={
        \pgfplotsset{
            axis line style=opaque,
            ticklabel style=opaque,
            tick style=opaque,
            grid=none
        }
        \pgfplotsdrawaxis
    },
} % applies to major and minor ticks,

\pgfplotsset{axis line on top/.style={
  axis line style=opaque,
  ticklabel style=transparent,
  tick style=opaque,
  axis on top=true,
  after end axis/.append code={
    \pgfplotsset{axis line style=opaque,
      ticklabel style=transparent,
      tick style=opaque,
      color=white,
      grid=true}
    \pgfplotsdrawaxis}
  }
} %% applies to axis line on top

\boldmath

\begin{document}

%% Graph Function of Linear Equations in Two Variables
%%Title
\begin{tikzpicture}
\node (0,0) {\textbf{Graphing of System}};
\node[below] at (0,-0.12) {\textbf{of}};
\node[below] at (0,-0.45) {\textbf{Linear Equations}};
\node[below] at (0,-0.80) {\textbf{with}};
\node[below] at (0,-1.15) {\textbf{Two Variables}};
\end{tikzpicture}
\begin{tikzpicture}[scale=1]
        \begin{axis}[x=1cm,y=1cm,
        latex-latex,
            axis lines = middle,
            xlabel = {$x$},
            ylabel = {$y$},
            %xtick = \empty,
            xtick style={-},
            %ytick = \empty,
            ytick style ={-},
            xmin=-5, xmax=4.5,
            ymin=-3.1, ymax=6.5,small, axis on top, grid=none, minor grid style={very thin,gray!30}, major grid style={very thin,gray!30},
            xticklabel style={fill=white!5,-},
            yticklabel style={fill=white!5,-}, extra y ticks={2}, extra y tick style={fill=white,-}]         
            % Plot 3
\addplot [
domain=-1:5,
samples=1000,
black,very thick,-
]
 coordinates{(-5,0)(-4,0.5)(-3,1)(-2,1.5)(-1,2)(0,2.5)(1,3)} 
            node [pos=1, right, black, sloped] {\bfseries $x-2y=-5$};
            \addplot[
            domain=-4:0,
            black,
            very thick,
            -]
            coordinates{
            (-5,-8)(-4,-4)(-3,-2)(-2,0)(-1,2)(0,4)(1,6)
            }
            node[pos=1, right, black]{\bfseries $2x-y=-4$};
            
            \addplot[black,dashed,-]
            coordinates{(-1,-3)(-1,2)} node[blue]{\Huge{}\textbullet};
            
            \addplot[black,dashed,-]
            coordinates{(-1,2)(3.5,2)};
        \end{axis}
    \end{tikzpicture}
\end{document}
2. Save file as GraphLinearEquation2Variables1.tex
3. Then build or typeset the Latex code.

Output


Bibliography

https://byjus.com/
https://bccampus.ca/ ( university )
https://www.cuemath.com/
https://www.nku.edu/ ( university )

Tidak ada komentar:

Posting Komentar

Various Other Posts