To get a reverse-order cumulative histogram in Matplotlib, we can use cumulative = -1 in the hist() method.Set the figure size and adjust the padding between and around the subplots.Make a list of data points.Plot a histogram with data and cumulative = -1.To display the figure, use show() method.Examplefrom matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True data = [1, 2, 2, 3, 1, 4, 3, 0, 1, 3, 0] plt.hist(data, edgecolor='black', align="mid", cumulative=-1) plt.show()Output
To use an update function to animate a NetworkX graph in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure using figure() method.Initialize a graph with edges, name, and graph attributes.Add nodes to the graph using add_nodes_from() method.Draw the graph G with Matplotlib.Use FuncAnimation() class to make an animation by repeatedly calling a function, animate.Function animate clears the current figure, generate two random numbers, and draws the edges between them.To display the figure, use show() method.Examplefrom matplotlib import pyplot as plt, ... Read More
To plot a pcolor colorbar in a different subplot in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots wuth two rows and two columns.Make a list of colormaps.Iterate the axes and create a pseudocolor plot with a non-regular rectangular grid.Make colorbars with the same axes of pcolormesh.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig, axs = plt.subplots(2, 2) cm = ['plasma', 'copper'] for col ... Read More
To plot a smooth 2D color plot for z = f(x, y) in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Get z data points using f(x, y).Display the data as an image, i.e., on a 2D regular raster, with z data points.To display the figure, use show() method.Exampleimport numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True def f(x, y): return np.array([i * i + j * j for j in ... Read More
To display two sympy plots as one Matplotlib plot, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Transform strings into instances of :class:'Symbol' class.Plot a function of a single variable as a curve.Use the extend method to add all the series of plot2 (p2) in plot1 (p1).To display the figure, use show() method.Examplefrom sympy import symbols from sympy.plotting import plot from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = symbols('x') p1 = plot(x*x, show=False) p2 = plot(x, show=False) p1.extend(p2) p1.show()OutputRead More
Use the create command to create a table. Insert the values that are book information into the created database table using insert command.If we want to view or retrieve the inserted data use the select command.Step 1Create a book table in database as follows −The create command is used to create table, view, indexSyntaxThe syntax for the create command is as follows −Create table tablename(col1 datatype(size), col2 datatype(size), ……….colN datatype(size));ExampleUse the below mentioned command −create table book (bookname varchar(30), authorname varchar(30), noofcopies number(20));The output is the table created as shown below −BooknameAuthornamenoofcopiesStep 2Describe − The command used to describe the ... Read More
Let’s see the stages of database system life cycle (DDLC) and their facts using tabular form −Stage of Database system development LifecycleExample of FactsExample of Documentation ProducedDatabase PlanningAims and objectives of database projects.Mission statements and objectives.System IdentificationDescription of major user views (Job roles, business application areas).Definition of scope and boundary of database system, definition of user views to be supported.Requirements Collection and AnalysisRequirements of user views, system specifications, including performance and security requirements.User requirement specification, system specification.Database designUser’s responses to checking the logical database design, functionality provided by target DBMS.Logical database design, data dictionary, physical database design.Application DesignUsers’ response to ... Read More
The different phases of database development life cycle (DDLC) in the Database Management System (DBMS) are explained below −Requirement analysis.Database design.Evaluation and selection.Logical database design.Physical database design.Implementation.Data loading.Testing and performance tuning.Operation.Maintenance.Now, let us understand these phases one by one.Requirement AnalysisThe most important step in implementing a database system is to find out what is needed i.e what type of a database is required for the business organization, daily volume of data, how much data needs to be stored in the master files etc.In order to collect all this information, a database analyst spends a lot of time within the business ... Read More
Query is a question or requesting information. Query language is a language which is used to retrieve information from a database.Query language is divided into two types −Procedural languageNon-procedural languageProcedural languageInformation is retrieved from the database by specifying the sequence of operations to be performed.For Example − Relational algebra.Structure Query language (SQL) is based on relational algebra.Relational algebra consists of a set of operations that take one or two relations as an input and produces a new relation as output.Types of Relational Algebra operationsThe different types of relational algebra operations are as follows −Select operationProject operationRename operationUnion operationIntersection operationDifference operationCartesian ... Read More
The aggregate functions are follows −max()min()sum()average()count()Consider the following tables −Employee − Emp(empid, ename, salary)EmpidEmpnameSalaryE1Ravi4000E2Sanjay3500E3Sruthi3000E4Alok3000E5Pritam3000Dept − Dept(deptid, dname)DepidDnameD1CseD2EceD3CivilProject − Project(projected, pname)ProjectidPnameP1DatabaseP2networkingWorksin − Worksin(empid, depid)EmpidDepidE1P1E2P2E3P1E4P2E5P2Assign − Assign(empid, projectid)EmpidProjectidE1P1E2P2E3P1E4P2E5P2Example 1Display the details of the employee who works in the ece department.Step 1Use the below mentioned syntax. Here, T1= deptid of EceT1=∏deptid(σdname=ece(dept))OutputDeptidD2Step 2Here, ⋈= {T1.deptid=worksin.deptid} and T2= all empid of EceT2= ∏empid(T1⋈worksin)OutputEmpidE3E4Step 3Here, T3=(T2⋈emp), ⋈={T2.empid=emp.empid} and T3= details of all employees of EceEmpidEmpnameSalaryE3Smruthi3000E4Alok3000Example 2Display all names of employees who work on database projects.Step 1Use the command mentioned below −T1=∏projectid(σpname=database(project))OutputProjectidP1Step 2Use the command given below −T2= ∏empid(T1⋈assign)OutputEmpidE1E2Step 3Use the command given below −T3= ∏empname(T2⋈emp)OutputEmpnameRaviSmrutiRead More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP