- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 784 Articles for Data Visualization
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
1K+ Views
To plot horizontal and vertical lines passing through a point, we can take the following stepsSet the figure size and adjust the padding between and around the subplots.Create two lines using slopes (m1, m2) and intercepts (c1 and c2). Initialize the slopes and intercepts values.Create x data points using numpy.Plot x, m1, m2, c2 and c1 data points using plot() method.Using intercepts and slopes values, find the point of intersection.Plot horizontal and vertical lines with dotted linestyle.Plot xi and yi points on the plotTo display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
325 Views
To plot 3D bars without axes, we can take the following stepsSet the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure using figure() method.Add an axes to the cureent figure as a subplot arrangement.Create x3, y3 and z3 data points using numpy.Create dx, dy and dz data points using numpy.Use bar3d() method to plot 3D bars.To hide the axes, use axis('off') class by name.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 fig = plt.figure() ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
12K+ Views
To plot overlapping lines in matplotlib, we can use variable overlapping that basically sets the opacity or alpha value in the plot.StepsSet the figure size and adjust the padding between and around the subplots.Initialize a variable overlapping to set the alpha value of the line.Plot line1 and line2 with red and green colors, respectively, with the same alpha value.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 overlapping = 0.150 line1 = plt.plot([1, 3, 5, 2, 5, 3, 1], c='red', alpha=overlapping, lw=5) line2 = plt.plot([7, 2, 5, 7, 5, 2, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
3K+ Views
To disable the minor ticks of a log plot in matplotlib, we can use minorticks_off() method.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Add a subplot to the current figure, at index 1.Plot x and y data points with color=red.Make x-scale as log class by name.Set the title of the current plot.Add a subplot to the current figure, at index 2.Plot x and y data points with color=green.Make x-scale as log class by name.Turn off the minor ticks of the plot.Set the title of the plot as index 2.To ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
1K+ Views
To give a border to a line in matplotlib plot function, we can call plot() function twice with varying line width.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot x and y data points where line width=10 and color=black.Again plot x and y points where line width=8 and color=red.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 x = np.linspace(-2, 2, 100) y = np.sin(x) plt.plot(x, y, c='black', lw=10) plt.plot(x, y, c='red', lw=8) plt.show()OutputRead More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
1K+ Views
We can use annotate() to place an emoji at the top of a bar.StepsSet the figure size and adjust the padding between and around the subplots.Make a list of frequencies and labels conatining emojis.Create a new figure or activate an existing figure using figure() method.Plot bars using bar() method.Use annotate() method to place emojis as a labelTo 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 freqs = [7, 8, 5, 3, 6] labels = ['😊', '😲', '😂', '😃', '😛'] plt.figure() p1 = plt.bar(np.arange(len(labels)), freqs) for rect1, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
5K+ Views
To plot scatter points on a 3D projection with varying marker size, we can take the following stepsSet the figure size and adjust the padding between and around the subplots.Create xs, ys and zs data points using numpyInitialize a variable 's' for varying size of marker.Create a figure or activate an existing figure using figure() method.Add an axes to the current figure as a subplot arrangement using subplots() method.Plot the xs, ys, and zs data points using scatter() method.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"] = ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
1K+ Views
To create a legend for a 3D bar in matplotlib, we can plot 3D bars and place a legend using legend() method.StepsSet the figure size and adjust the padding between and around the subplots.Create a new figure or activate an esxisting figure using figure() method.Add an axes to the figure as part of a subplot arrangement.Create a list of data x3, y3, z3, dx, dy and dz using numpy.Plot a 3D bar using bar3d() method.Create a rectangle axis for legend placement.Use legend() method to place the legend for bars.To display the figure, use show() method.Exampleimport numpy as np from matplotlib ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
679 Views
To plot scatter points on a 3D plot without axes in matplotlib, we can use scatter() method and make the axes OFF.StepsSet the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure using figure() method.Add an axis as a subplot arrangement.Create xs, ys and zs data points using numpy.Use scatter() method to create a scatter plot.Use ax.axis('off') method to hide the axes.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 fig = plt.figure() ax = fig.add_subplot(projection="3d") ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
774 Views
To plot distance arrows in technical drawing in matplotlib, we can use annotate() method with arrow properties.StepsSet the figure size and adjust the padding between and around the subplots.Add a horizontal line across the axis using axhline() method, i.e., y=3.5.Add a horizontal line across the axis using axhline() method, i.e., y=2.5.Use annotate() method to draw an arrow line to show the distance and in the very next statement, use annotate() method again to display the distance between two horizontal lines.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 plt.axhline(3.5) plt.axhline(2.5) ... Read More