- 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
Rishikesh Kumar Rishi has Published 1162 Articles
Rishikesh Kumar Rishi
8K+ Views
We can use the method, plt.figure(), to create the figures, and then, set their titles by passing strings as arguments.StepsCreate a new figure, or activate an existing figure, with the window title “Welcome to figure 1”.Draw a line using plot() method, over the current figure.Create a new figure, or activate ... Read More
Rishikesh Kumar Rishi
4K+ Views
Get fig from plt.figure() and create three different axes using add_subplot, where projection=3d.Set up the figure title using ax.set_title("name of the figure"). Use the method ax.quiver to plot vector projection, plot3D for cube, and plot_wireframe for sphere after using sin and cos.StepsCreate a new figure, or activate an existing figure.To ... Read More
Rishikesh Kumar Rishi
7K+ Views
First, we can get the axes. Then, ax.spines could help to set the color by specifying the name of the axes, i.e., top, bottom, right and left.StepsAdd an axes to the current figure and make it the current axes.Using step 1 axes, we can set the color of all the ... Read More
Rishikesh Kumar Rishi
4K+ Views
We can set the logarithmic bins while plotting histogram using plt.hist(bin="").StepsCreate an array x, where range is 100.Plot a histogram using plt.hist() method. We can pass logarithmic bins using logarithmic bins that returns numbers spaced evenly on a log scale.Get the current axes, creating one if necessary and set the ... Read More
Rishikesh Kumar Rishi
519 Views
Using plt.rcParams["figure.figsize"], we can get the width setting.StepsTo get the plot width setting, use plt.rcParams["figure.figsize"] statement.Override the plt.rcParams["figure.figsize"] with a tuple (12, 9).After updating the width, get the updated width using plt.rcParams["figure.figsize"].ExamplesIn IDEExampleimport matplotlib.pyplot as plt print("Before, plot width setting:", plt.rcParams["figure.figsize"]) plt.rcParams["figure.figsize"] = (12, 9) print("Before, plot width setting:", plt.rcParams["figure.figsize"])OutputBefore, ... Read More
Rishikesh Kumar Rishi
12K+ Views
We can first create bars and then, by using set_color, we can set the color of the bars.StepsPass two lists consisting of four elements, into the bars method argument.Step 1 returns bars.Return values (0, 1, 2, 3) can be set with different colors, using set_color() method. Green, Black, Red color ... Read More
Rishikesh Kumar Rishi
5K+ Views
Using the FuncAnimation method of matplotlib, we can animate the diagram. We can pass a user defined method where we will be changing the position of the particles, and at the end, we will return plot type.StepsGet the particle's initial position, velocity, force, and size.Create a new figure, or activate ... Read More
Rishikesh Kumar Rishi
628 Views
Using the figure() method, we can set the current figure.StepsCreate a new figure, or activate an existing figure, with the window title “Welcome to figure 1”.Create a new figure, or activate an existing figure, with the window title “Welcome to figure 2”.Using plt.show(), show the figures.Examplefrom matplotlib import pyplot as ... Read More
Rishikesh Kumar Rishi
6K+ Views
We will create two lines, i.e., line1 and line2. After that, we will pop the second line and will remove it.StepsCreate lists for line1 and line2.Plot line1 and line 2 using plot() method, line 2 with style =’dashed’.Set or retrieve auto-scaling margins(0.2).Pop line 2, and remove it using remove() method.The ... Read More
Rishikesh Kumar Rishi
4K+ Views
Subplot can split the figure in nrow*ncols parts and plt.xticks could help to plot the xticks for subplots.StepsCreate two lists for line 1 and line 2.Add a subplot to the current figure, nrow = 1, ncols = 2 and index = 1.Draw line 1 with style as dashed.Set or retrieve ... Read More
To Continue Learning Please Login
Login with Google