{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tkinter import *\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from pylab import plot, show, xlabel, ylabel\n",
    "from tkinter import messagebox\n",
    "import math\n",
    "\n",
    "\n",
    "x=0\n",
    "myw=Tk()\n",
    "myw.geometry('300x300')\n",
    "myw.configure(bg='yellow')\n",
    "myw.title('Graph Plotter')\n",
    "myvar=IntVar()\n",
    "\n",
    "# TRIGNOMETRY\n",
    "mymenu=Menu(myw)\n",
    "myw.config(menu=mymenu)\n",
    "trigmenu=Menu(mymenu)\n",
    "mymenu.add_cascade(label='trignometry',menu=trigmenu)\n",
    "trigmenu.add_command(label='Sinx',command=lambda:LoadSinGraph())\n",
    "trigmenu.add_command(label='cosx',command=lambda:LoadCosGraph())\n",
    "trigmenu.add_command(label='Tanx',command=lambda:LoadTanGraph())\n",
    "trigmenu.add_separator()\n",
    "trigmenu.add_command(label='Cosecx')\n",
    "trigmenu.add_command(label='secx')\n",
    "trigmenu.add_command(label='cotx')\n",
    "\n",
    "# EXPONENTIAL\n",
    "expmenu=Menu(mymenu)\n",
    "mymenu.add_cascade(label='Exponential',menu=expmenu)\n",
    "expmenu.add_command(label='Show',command=lambda:LoadExponGraph())\n",
    "\n",
    "\n",
    "#AlGEBRAIC\n",
    "algmenu=Menu(mymenu)\n",
    "mymenu.add_cascade(label='Algebraic',menu=algmenu)\n",
    "algmenu.add_command(label='Show',command=lambda:LoadAlgGraph())\n",
    "\n",
    "#LOGARITHM \n",
    "logmenu=Menu(mymenu)\n",
    "mymenu.add_cascade(label='Logarithm',menu=logmenu)\n",
    "logmenu.add_command(label='Show',command=lambda:LoadLogGraph())\n",
    "\n",
    "#PIECHART\n",
    "piemenu=Menu(mymenu)\n",
    "mymenu.add_cascade(label='PieChart',menu=piemenu)\n",
    "piemenu.add_command(label='Show',command=lambda:LoadPieGraph())\n",
    "\n",
    "\n",
    "\n",
    "def LoadSinGraph():\n",
    "    t = np.arange(0.0, 24, 0.01)\n",
    "    s = np.sin(t)\n",
    "    fig, ax = plt.subplots()\n",
    "    ax.plot(t, s)\n",
    "    ax.set(xlabel='radians', ylabel='Sin(x)',\n",
    "       title='Sine Plot')\n",
    "    ax.grid()\n",
    "\n",
    "    plt.show()\n",
    "    \n",
    "def LoadCosGraph():\n",
    "                \n",
    "\n",
    "    t = np.arange(0.0, 24, 0.01)\n",
    "    s = np.cos(t)\n",
    "    fig, ax = plt.subplots()\n",
    "    ax.plot(t, s)\n",
    "    ax.set(xlabel='radians', ylabel='(cosx)',\n",
    "    title='Cosine Plot')\n",
    "    ax.grid()\n",
    "    plt.show()\n",
    "def LoadTanGraph():\n",
    "    t = np.arange(0.0, 1, 0.01)\n",
    "    s = np.tan(t)\n",
    "    fig, ax = plt.subplots()\n",
    "    ax.plot(t, s)\n",
    "    ax.set(xlabel='radians', ylabel='tan(x)',\n",
    "       title='Tangent Plot')\n",
    "    ax.grid()\n",
    "    plt.show()\n",
    "\n",
    "def LoadExponGraph():\n",
    "                   \n",
    "    x= np.array([1,3,5])\n",
    "    y=[2,4,6]\n",
    "    z=np.exp(x)\n",
    "    w=np.exp(y)\n",
    "    plt.plot(x,z,color=\"blue\",marker='*')\n",
    "    plt.plot(y,w,color=\"red\",marker='o')\n",
    "    plt.xlabel(\"X Axis--------->\")\n",
    "    plt.ylabel(\"Y Axis--------->\")\n",
    "    plt.title(\"Exponential\")\n",
    "    plt.show()\n",
    "\n",
    "\n",
    "def LoadLogGraph():            \n",
    "                   \n",
    "    x = np.linspace(0.001, 16, 2000)\n",
    "    y_e = np.log(x)\n",
    "    y_10 = np.log10(x)\n",
    "    y_2 = np.log2(x)\n",
    "\n",
    "    plt.plot(x, y_e)\n",
    "    plt.plot(x, y_10)\n",
    "    plt.plot(x, y_2)\n",
    "    plt.title(\"Log Graph\")\n",
    "    plt.legend(['ln', 'log10', 'log2'], loc='lower right')\n",
    "    plt.xticks(range(math.floor(min(x)), math.ceil(max(x))+1))\n",
    "    plt.axhline(0, color='black', linewidth='0.5')\n",
    "    plt.axvline(0, color='black', linewidth='0.5')            \n",
    "                   \n",
    "def LoadPieGraph():\n",
    "    \n",
    "    cars = ['AUDI', 'BMW', 'FORD', \n",
    "        'TESLA', 'JAGUAR', 'MERCEDES'] \n",
    "\n",
    "    data = []\n",
    "    for i in range(0,6):\n",
    "        print(cars[i])\n",
    "        dt=int(input(\"Enter data: \"))\n",
    "        data.append(dt)\n",
    "    print(data)    \n",
    "  \n",
    "   # Creating plot \n",
    "    fig = plt.figure(figsize =(10, 7)) \n",
    "    plt.pie(data, labels = cars)\n",
    "    plt.title(\"Pie Chart\")\n",
    "  \n",
    "     # show plot \n",
    "    plt.show() \n",
    "\n",
    "def LoadAlgGraph():\n",
    "    # Creating vectors X and Y \n",
    "    x = np.linspace(-2, 2, 100) \n",
    "    y = x ** 2\n",
    "  \n",
    "    fig = plt.figure(figsize = (10, 5)) \n",
    "# Create the plot \n",
    "    plt.plot(x, y) \n",
    "    plt.title(\"y=x^2\")\n",
    " # Show the plot \n",
    "    plt.show() \n",
    "    \n",
    "\n",
    "\n",
    "mainloop()\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
