Matplotlib Python Example | Matplotlib for Python




Matplotlib (Python Plotting Library)

 mat plot

Matplot

  • Human minds are greater adaptive for the visual representation of data alternatively than textual data. We can effortlessly recognize things when they are visualized.
  • It is easy to represent the data through the graph where we can analyze the data more successfully and make the particular choice according to data analysis.

Data Visualization

 data visualize

Data Visualization

  • Graphics gives a magnificent way to deal with exploring the information, which is fundamental for introducing results. Data visualization is another term.
  • It expresses the idea that involves more than just representing data in the graphical form (instead of using textual form).
  • It communicates the opportunity that involoves representing data in the graphical shape (rather than making use of textual form).
  • This can be helpful when discovering and getting to know a dataset and can help with ordering patterns, Outliers, corrupt data and much more.
  • A little domain knowledge, data visualizations can be used to categorical and reveal key relationships in plots and charts.
  • The static does certainly center of attention on quantitative description and estimations of data. It gives an necessary set of tools for gaining a qualitative understanding.

There are five key plots that are used for data visualization.

 plots

Plots

 Bar Graph

Bar Graph

 Histo Gram

Histogram

 Pie Plots

Pie Plots

Scatter Plots

Scatter Plots

There are five phases which are essential to make the decision for the organization:

 matploitlib five faces

Finding Insights

Visualize

  • We analyze the raw data, which ability it makes complicated data more accessible, understandable, and greater usable.
  • Tabular data representation is used the place the user will look up a particular measurement, while the chart of various kinds is used to show patterns or relationships in the data for one or more variables.

Analysis

  • Data analysis is described as cleaning, inspecting, transforming, and modeling data to derive beneficial information.
  • Whenever we make a selection for the business or in every day life, is by way of past experience. What will occur to select a unique decision, it is nothing but examining our past. That may additionally be affected in the future, so the suitable evaluation is necessary for better decisions for any business or organization.

Document Insight

  • Document insight is the method the place the beneficial data or information is prepared in the document in the standard format.

Transform Data Set

  • Standard data is used to make the decision effectively.

Why need data visualization ?

  • Data representation can perform the following tasks:
    • It recognizes regions that need improvement and consideration.
    • It explains the variables.
    • It helps with understanding which item to put where.
    • Predict sales volumes.

Advantages of Data Visualization

  • Here are a few advantages of the data visualization, which helps to make powerful choice for the organizations or business:

1. Building ways of absorbing information

  • Data visualization permits users to receive significant amounts of data related to operational and business conditions. It helps decision-makers to see the relationship between multi-dimensional data sets.
  • It offers new approaches to analyses data through the use of maps, fever charts, and other rich graphical representations.
  • Visual data discovery is greater possibly to find the information that the organization desires and then quit up with being more productive than different aggressive companies.

2. Visualize relationship and patterns in Businesses

  • The advantage of data visualization is that it is necessary to discover the correlation between running conditions and business performance in modern day highly aggressive business environment.
 Visualize Reletionship

Visualize Reletionship

 Visualize Reletionship

Visualize Reletionship

  • The capacity to make these kinds of relationships enables the officials to recognize the main cause of the issue and act quickly to resolve it.
  • Assume a food business enterprise is looking their month-to-month purchaser data, and the records is with bar charts, which indicates that the company's rating has dropped by means of five points in the previous months in that specific region
  • The data propose that there's an issue with consumer satisfaction around there.

3. Make a move on the developing patterns quicker

  • Data visualization approves the decision-maker to draw close shifts in customer behavior and market conditions throughout multiple data sets more efficiently.
  • Having an thought about the customer's sentiments and different data discloses an rising possibility for the business enterprise to act on new commercial business opportunities ahead of their competitor.

4. Geological based Visualization

  • Geo-spatial visualization is happened because of numerous sites giving web-services, pulling to guest's advantage.
  • These kinds of sites are required to take advantage of location-spcific data, which is already present in the customer details.
  • Matplotlib is a Python library which is characterized as a multi-stage data visualization library based on Numpy array.
  • It can be used in python scripts, shell, web application, and other graphical UI toolbox.
  • The John D. Tracker initially considered the matplotlib in 2002. It has a active development community and is circulated under a BSD-style license.
  • Its first version was released in 2003, and the most recent version 3.1.1 is released on 1 July 2019.
  • Matplotlib 2.0.x supports Python version 2.7 to 3.6 till 23 June 2007.
  • Python3 support began with Matplotlib 1.2. Matplotlib 1.4 is the last version that supports Python 2.6.
  • There are different toolboxs accessible that are used to upgrade the functionality of the matplotlib. A portion of these tools are downloaded independently, others can be moved with the matplotlib source code however have external conditions.
    • Bashmap : It is a map plotting toolbox with a few guide projections, coastlines, and political limits.
    • Cartopy : It is a planning library consisting of item arranged guide projection definitions, and image transformation abilities, line, polygon, and arbitary point.
    • Excel Tools : Matplotlib gives the facility to utilities to trading information with Microsoft Excel.
    • Mplot3d : It is used for 3D plots.
    • Natgrid : It is an interface to the Natgrid library for unpredictable gridding of the spaced data.

Matplotlib Architecture

 matplotlib architecture

Matplotlib Architecture

  • There are three different layers in the architecture of the matplotlib which are the following:
    • Backend Layer
    • Artist layer
    • Scripting layer

Backend layer

  • The backend layer is the base layer of the figure, which comprises of the execution of the different capacities that are essential for plotting.
  • There are three basic classes from the backend layer FigureCanvas (The surface on which the figure will be drawn), Renderer (The class that deals with the drawing on surface), and Event (It handle the mouse and keyboard Events).

Artist Layer

  • The Artist layer is the second layer in the design.
  • It is responsible for the various plotting functions, like axis, which coordinates on how to use the renderer on the figure canvas.

Scripting layer

  • The scripting layer is the highest layer on which a large portion of our code will run.
  • The techniques in the scripting layer, consequently deal with different layers, and all we have to think about is the current state (figure and subplot).

The General Concept of Matplotlib

  • A Matplotlib figure can be categorized into various parts as below:
 axes

Axes

  • We can think of a Figure as a canvas that holds plots.

Axes

  • A Figure can contain various Axes. It consists of two or three (in the case of 3D) Axis objects.
  • Each Axes is comprised of a title, an x-label, and a y-label.

Axis

  • Axises are the variety of line like objects and responsible for generating the graph limits.

Artist

  • The artist is the all which we see on the graph like Text objects, Line2D objects, and collection objects. Most Artists are attached to Axes.

Installing Matplotlib

  • Before begin working with the Matplotlib or its plotting functions first, it needs to be installed.
  • The set up of matplotlib is based on the distribution that is set up on your computer. These installation strategies are following:

Use the Anaconda distribution of Python

  • The easiest approach to introduce Matplotlib is to download the Anaconda distribution of Python.
  • The set up of matplotlib is based on the distribution that is set up on your computer.
  • Visit the official website of Anaconda and snap on the Download Button
 anaconda distribution

Anaconda Distribution

  • Choose download according to your Python interpreter configuration.
 windows installer

Windows Installer

Install Matplotlib using with Anaconda Prompt

  • Matplotlib can be installed with the help of Anaconda Prompt by typing command. To install matplotlib, open Anaconda Prompt and type the below command:
conda install matplotlib

Install Matplotlib with pip

  • The python package supervisor pip is additionally used to install matplotlib. Open the command window, and type the below command:
pip install matplotlib

Verify the Installation

  • To verify that matplotlib is installed properly or not, type the following command includes calling .__version __ in the terminal.
import matplotlib  
matplotlib.__version__  
'3.1.1'  

Basic Example of plotting Graph

  • Here is the basic example of generating a simple graph.
 plotting graph

Basic Example of plotting Graph

Sample Code 1

from matplotlib import pyplot as plt  
import matplotlib.pyplot as plt
x = [4,6,8]
y = [3,5,7] 
plt.plot(x, y) 
plt.xlabel('x - axis') 
plt.ylabel('y - axis') 
plt.title('My first graph!')
plt.show()

Output

 matplotlib graph

First Graph

  • It takes just three lines to plot a simple graph using the python matplotlib.
  • We can add titles, labels to our graph which are made by python matplotlib library to make it more meaningful.

    Sample Code 2

    import matplotlib.pyplot as plt
    left = [1, 2, 3, 4, 5] 
    height = [12, 28, 30, 43, 7]
    tick_label = ['one', 'two', 'three', 'four', 'five']
    plt.bar(left, height, tick_label = tick_label, width = 0.8, color = ['red', 'green']) 
    plt.xlabel('x - axis')
    plt.ylabel('y - axis') 
    plt.title('My bar chart!') 
    plt.show()
    

    Output

     bar-chart

    Bar Chart

    The graph is more understandable from the previous graph.

    Sample Code 3

    import matplotlib.pyplot as plt
    x = [1,2,3,4,5,6,7,8,9,10]  
    y = [2,4,6,8,10,12,14,16,18,20] 
    plt.scatter(x, y, label= "stars", color= "green",  marker= "*", s=30) 
    plt.xlabel('x - axis')
    plt.ylabel('y - axis') 
    plt.title('My scatter plot!') 
    plt.legend() 
    plt.show() 
    

    Output

     scalter plot

    Scatter Plot

    Working with Pyplot

    • The matplotlib.pyplot is the collection command style features that make matplotlib feel like working with MATLAB.
    • The pyplot features are used to make some changes to figure such as create a figure, creates a plotting region in a figure, plots some lines in a plotting area, decorates the plot which includes labels, etc.
    • It is excellent to use when we choose to plot something shortly except instantiating any figure or Axes.
    • While working with matplotlib.pyplot, some states are stored across function calls so that it maintains track of the things like current figure and plotting area, and these plotting functions are directed to the current axes.
    • The pyplot module provide the plot() function which is regularly use to plot a graph.

    Sample Code

    import matplotlib.pyplot as plt
    x = [3,5,7] 
    y = [2,8,16]
    plt.plot(x,y)
    plt.title('Info')
    plt.ylabel('Y axis')
    plt.xlabel('X axis')
    plt.show()
    

    Output

     info graph

    Info Graph

    Formatting the style of the plot

    • There is an optional third argument, which is a format string that demonstrates the color and line type of the plot.
    • The default format string is 'b-'which is the strong blue as you can see in the above plotted diagram. Just think about the following example the place we plot the graph with the red circle.

    Sample Code

    import matplotlib.pyplot as plt
    x = [1,1.9,2,8.5,3,5.7,3.4]
    y = [6.2,8,8.3,9,9.7,10,10.2]
    x1=[8,3.5,9,9.5,10,10.2,13]
    y1=[5,3.3,3.8,4,4.5,5,5.7]
    plt.scatter(x,y, label='high income low saving',color='r')
    plt.scatter(x1,y1,label='low income high savings',color='b')
    plt.xlabel('saving*100')
    plt.ylabel('income*1000')
    plt.title('Scatter Plot')
    plt.legend()
    plt.show()

    Output

     scatter plot

    Scatter Plot

    Example format String

    'b' Using for the blue marker with default shape.
    'ro' Red circle
    '-g' Green solid line
    '--' A dashed line with the default color
    '^k:' Black triangle up markers connected by a dotted line

    Matplotlib supports the following color abbreviation

    Character Color
    'b' Blue
    'g' Green
    'r' Red
    'c' Cyan
    'm' Magenta
    'y' Yellow
    'k' Black
    'w' White

    Plotting with categorical variables

    • Matplotlib allows us to pass categorical variables directly to many plotting functions.

    Sample Code

    from matplotlib import pyplot as plt
    names = ['Wikitechy', 'Kaashiv', 'Kaashiv InfoTech']  
    marks= [78,89,95]  
      
    plt.figure(figsize=(9,3))  
      
    plt.subplot(131)  
    plt.bar(names, marks)  
    plt.subplot(132)  
    plt.scatter(names, marks)  
    plt.subplot(133)  
    plt.plot(names, marks)  
    plt.suptitle('Categorical Plotting')  
    plt.show()  
    

    Output

     Categorical Graph

    Categorical Graph

    In the above program, we've plotted the categorical graph using the subplot() function.

    What is subplot () ?

    • The Matplotlib subplot () function is defined on plot two or more plots in one picture.
    • we will use this method to separate two graphs which plotted within the same axis Matplotlib supports all types of subplots, including 2x1 vertical, 2x1 horizontal, or a 2x2 grid.
    • It accepts the three arguments: They're nrows, ncols, and index. It denote the amount of rows, number of columns and the index.

    The subplot() function can be called within the following way:

    subplot(nrows,ncols,index,**kwargs)  
    subplot(pos,**kwargs)     
    subplot(ax)  
    

    Parameters

    • *args :
      • Three separate integers or three-digit integer describes the position of the subplot.
      • If the three integers are nrows, ncols, and index in order, the subplot will take the index position on a grid with nrows row and ncol column.
      • The argument pos are a three-digit integer, where the primary digit is denoted the amount of rows, the second digit denoted the amount of columns, and the third represents the index of the subplot. For instance, subplot (1, 3, 2) is that the same as the subplot (132).
    • **kwargs
      • The subplot () function also accepts the keyword arguments for the returned axes base class.

    Important Functions of Matplotlib

    Functions Description
    plot(x-axis value, y-axis-values) To plot an easy line graph with x-axis value against the y-axis values. show() it's used to display the graph.
    title("string") To set the title of the plotted graph as specified by the string.
    xlabel("string") To set the label for the x-axis as specified by the string.
    ylabel("string") To set the label for y-axis as specified by the string.
    figure() To control a figure level attributes.
    subplots(nrows,ncol,index) To add a subplot to recent figure.
    subtitle("string") It adds a standard title to the plotted graph specified by the string.
    subplots(nrows,ncols,figsize) It provides the easy way to create subplot, during a single call and returns a tuple of a figure and number of axes.
    set_title("string") It is an axes level method which is used to set the title of the subplots.
    bar(categorical variables, values, color) To create a vertical bar chart .
    barh(categorical variables, values, color) To create horizontal bar graphs.
    legend(loc) To make a legend of the graph.
    xtricks(index, categorical variables) To set or get the present tick locations labels of the x-axis.
    pie(value, categorical variables) To create a chart .
    hist(value, number of bins) To create a histogram.
    xlim(start value, end value) To set the limit of values of the x-axis.
    ylim(start value, end value) To set the limit of values of the y-axis.
    scatter(x-axis values, y-axis values) To plots a scatter plot with x-axis value against the y-axis values.
    axes() To add axes to the recent figure.
    set_xlabel("string") It is an axes level method which is used to set the x-label of the plot specified as a string.
    set_ylabel("string") To set the y-label of the plot specified as a string.
    scatter3D(x-axis values, y-axis values): To plot a three-dimension scatter plot with x- axis value against the y-axis.
    plot3D(x-axis values, y-axis values): To plots a three-dimension line graph with x- axis values against y-axis values.

    Creating Different Types of Graph

    Line graph

    • The line graph is one of charts which shows information as a series of the line.
    • The graph is plotted by the plot() function.

    Sample Code 1

    import matplotlib.pyplot as plt
    import numpy as np
    x = np.linspace(-1, 10, 50)
    print(x)
    y = 2*x + 3
    plt.plot(x, y)
    plt.show()

    Output

     graph one

    Graph line

    • We can alter the diagram by importing in the style module.
    • The style module will be built with a matplotlib installation.
    • It contains the different functions to make the plot attractive.
    • In the below program, we are using the style module.

    Sample Code 2

    import matplotlib.pyplot as plt
    import numpy as np
    x = np.linspace(-1, 3, 43)
    y = 2**x + 1
    plt.plot(x, y) 
    plt.show()
    

    Output

     graph two

    Curved Line

    • In Matplotlib, the figure (an instance of class plt.Figure) can be supposed of as a single container that consists of all the objects denoting axes, graphics, text, and labels.

    Sample Code 3

    import matplotlib.pyplot as plt
    import numpy as np
    n = 1024
    X = np.random.normal(0, 1, n)
    Y = np.random.normal(0, 3, n)
    T = np.arctan2(X, Y)
    plt.scatter(np.arange(5), np.arange(5))
    plt.xticks(())
    plt.yticks(())
    plt.show()
    

    Output

     graph four

    Plotted Graph

    Sample Code 4

    import matplotlib.pyplot as plt
    import numpy as np
    x = [1,2,5,8,9,11,13,15,17]
    plt.plot(x)
    plt.ylabel('Moon')
    plt.xlabel('Time')
    plt.show()

    Output:

     graph four

    Curved Line Graph

    Bar Graphs

    • Bar Graphs are one of the most common types of graphs and are used to show data related with the categorical variables.
    • Matplotlib gives a bar() to make bar charts which accepts arguments, for example, categorical variables, their value and color.

    Sample Code 1

    import matplotlib.pyplot as plt
    import numpy as np
    objects = ('matplotlib', 'C++', 'Java', 'C', 'AI', 'Lisp')
    y_pos = np.arange(len(objects))
    performance = [7,8,4,1,5,3]
    plt.bar(y_pos, performance, align='center', alpha=0.5)
    plt.xticks(y_pos, objects)
    plt.ylabel('Usage')
    plt.title('Programming language ')
    plt.show()
    

    Output

     bar graph programming langugae

    Bar Graph Programming Language

    Sample Code 2

    import numpy as np 
    import matplotlib.pyplot as plt
    # creating the dataset 
    data = {'C':23, 'C++':14, 'Java':30,  'matplotlib':34} 
    courses = list(data.keys()) 
    values = list(data.values()) 
    fig = plt.figure(figsize = (10, 5)) 
    # creating the bar plot 
    plt.bar(courses, values, color ='maroon', width = 0.4) 
    plt.xlabel("Courses") 
    plt.ylabel("No. of students enrolled") 
    plt.title("Students enrolled in different courses") 
    plt.show()
    

    Output

     bar graph student enrolled

    Bar Graph Student Enrolled

    Sample Code 3

    import matplotlib.pyplot as plt
    population_ages = [22,55,62,45,21,22,34,42,42,4,99,102,110,120,]
    bins = [0,10,20,30,40,50,60,70,80,90,100,110,120,130]
    plt.hist(population_ages, bins, histtype='bar', rwidth=0.8)
    plt.xlabel('x')
    plt.ylabel('y')
    plt.title('bar Graph')
    plt.legend()
    plt.show()
    import matplotlib.pyplot as plt
    population_ages = [22,55,62,45,21,22,34,42,42,4,99,102,110,120,]
    bins = [0,10,20,30,40,50,60,70,80,90,100,110,120,130]
    plt.hist(population_ages, bins, histtype='bar', rwidth=0.8)
    plt.xlabel('x')
    plt.ylabel('y')
    plt.title('bar Graph')
    plt.legend()
    plt.show()
    

    Output

     bar graph

    Bar Graph

    Pie Chart

    • A pie chart is a circular graph that is separated in the section or slices of pie.
    • It is commonly used to represent the percentage or proportional data where each slice of pie represents a specific category.

    Sample Code 1

    import matplotlib.pyplot as plt
    slices_hours = [3, 7]
    activities = ['rest', 'Work']
    colors = ['r', 'b']
    plt.pie(slices_hours, labels=activities, colors=colors, startangle=90, autopct='%.1f%%')
    plt.show()
    

    Output

     pie chart

    Pie Chart

    Sample Code 2

    import matplotlib.pyplot as plt
    labels = 'cloud', 'C++', 'matplotlib', 'Java'
    sizes = [215, 130, 245, 210]
    colors = ['lightskyblue', 'yellowgreen', 'lightcoral', 'gold']
    explode = (0.1, 0, 0, 0)  # explode 1st slice
    # Plot
    plt.pie(sizes, explode=explode, labels=labels, colors=colors,
    autopct='%1.1f%%', shadow=True, startangle=140)
    plt.axis('equal')
    plt.show()
    

    Output

     pie chart two

    pie chart lang

    Histogram

    • We'd like to know the difference between the bar chart and histogram.
    • A histogram is used for the distribution, whereas a bar graph is used to match different entities.
    • A histogram may be a kind of bar plot that shows the frequency of variety of values compared to a set of values ranges.

    For example, we take the data of the various age group of the people and plot a histogram with respect to the bin. Bin represents the range of values that are divided into series of intervals. Bins are generally created of an equivalent size.

    Sample Code 1

    from matplotlib import pyplot as plt  
    from matplotlib import pyplot as plt  
    population_age = [40,50,63,70,21,25,58,18,25,19,67]  
    bins = [0,10,20,30,40,50,60,70,80,90,100]  
    plt.hist(population_age, bins, histtype='bar', rwidth=0.8)  
    plt.xlabel('Age groups')  
    plt.ylabel('No. of people')  
    plt.title('Histogram Example')  
    plt.show() 

    Output

     Histogram graph

    Histogram graph

    Sample Code 2

    from matplotlib import pyplot as plt  
    # Importing Numpy Library  
    import numpy as np  
    plt.style.use('fivethirtyeight')  
      
    mu = 30  
    sigma = 9  
    x = np.random.normal(mu, sigma, size=200)  
    fig, ax = plt.subplots()  
      
    ax.hist(x, 20)  
    ax.set_title('Historgram')  
    ax.set_xlabel('Bin range')  
    ax.set_ylabel('Frequency')  
      
    fig.tight_layout()  
    plt.show()  
    

    Output

     Histogram graph

    Histogram graph

    Scatter plot

    • The scatter plots are mostly used for comparing variables once we need to define what proportion one variable is affected by another variable.
    • The data is displayed as a set of points. Each point has the worth of 1 variable, which defines the position on the horizontal axes, and therefore the value of other variable represents the position on the vertical axis.

    Sample Code 1

    from matplotlib import pyplot as plt  
    from matplotlib import style  
    style.use('ggplot')  
      
    x = [8,10,7]  
    y = [20,6,10]  
      
    x2 = [5,9,8]  
    y2 = [7,14,17]  
      
    plt.scatter(x, y)  
      
    plt.scatter(x2, y2, color='g')  
      
    plt.title('Info')  
    plt.ylabel('Y axis')  
    plt.xlabel('X axis')  
      
    plt.show() 

    Output

     scatter-plot

    Scatter Plot

    Sample Code 2

    import matplotlib.pyplot as plt  
    x = [89, 90, 70, 89, 100, 80, 90, 100, 80, 34]  
    y = [30, 29, 49, 48, 100, 48, 38, 45, 20, 30] 
      
    x1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]  
    
    plt.scatter(x1, x, label='Girls Grade', color='g')  
    plt.scatter(x1, y, label='Boys Grades', color='r')  
    plt.xlabel('Grades Range')  
    plt.ylabel('Grades Scored')  
    plt.title('Scatter Plot')  
    plt.legend()  
    plt.show()  
    

    Output

     scatter-plot

    Scatter Plot

    3D Graph Plot

    • Matplotlib was initially developed with only two-dimension plot.
    • Its 1.0 release was built with a number of three-dimensional plotting utilities on top of two-dimension display, and therefore the result's a convenient set of tools for 3D data visualization.

    Three-dimension plots are often created by importing the mplot3d toolkit, include with the most Matplotlib installation:

    from mpltoolkits import mplot3d
    • When this module is imported within the program, three-dimension axes are often created by passing the keyword projection='3d' to any of the normal axes creation routines:

    Sample Code 1

    from mpl_toolkits import mplot3d  
    import numpy as np  
    import matplotlib.pyplot as plt  
    fig = plt.figure()  
    ax = plt.axes(projection='3d')
    plt.show()

    Output

     3D Graph

    3D Graph

    Sample Code 2

    from mpl_toolkits import mplot3d  
    import numpy as np  
    import matplotlib.pyplot as plt  
      
    height = np.array([100,110,87,85,65,80,96,75,42,59,54,63,95,71,86])  
    weight = np.array([105,123,84,85,78,95,69,42,87,91,63,83,75,41,80])  
      
      
      
    fig = plt.figure()  
    ax = plt.axes(projection='3d')  
    # This is used to plot 3D scatter  
    ax.scatter3D(height,weight)  
    plt.title("3D Scatter Plot")  
    plt.xlabel("Height")  
    plt.ylabel("Weight")  
    plt.title("3D Scatter Plot")  
    plt.xlabel("Height")  
    plt.ylabel("Weight")  
      
    plt.show() 

    Output

     3D Graph

    3D Graph

    Sample Code 3

    import matplotlib as mpl  
    from mpl_toolkits.mplot3d import Axes3D  
    import numpy as np  
    import matplotlib.pyplot as plt  
      
    mpl.rcParams['legend.fontsize'] = 10  
      
    fig = plt.figure()  
    ax = fig.gca(projection='3d')  
    theta1 = np.linspace(-5 * np.pi, 4 * np.pi, 100)  
    z = np.linspace(-3, 2, 100)  
    r = z**3 + 1  
    x = r * np.sin(theta1)  
    y = r * np.cos(theta1)  
    ax.plot3D(x, y, z, label='parametric curve')  
    ax.legend()  
      
    plt.show()  
    

    Output

     3D Graph

    3D Graph



    Related Searches to Matplotlib Python Example | Matplotlib for Python

    Adblocker detected! Please consider reading this notice.

    We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

    We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

    We need money to operate the site, and almost all of it comes from our online advertising.

    Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

    ×