- 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
Rishikesh Kumar Rishi has Published 1162 Articles
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
1K+ Views
Use the plot method of matplotlib and set the legend with different sets of colors.StepsSet the X-axis label using plt.xlabel() method.Set the Y-axis label using plt.ylabel() method.Plot the lines using plt.plot() method with [9, 5], [2, 5] and [4, 7, 8] array.Initialize two variables; location = 0 for the best ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
448 Views
Using the savefig method of the pyplot package, we can save the figure remotely by specifying the location of the figure.StepsTo use a different backend, set it using matplotlib.use('Agg') method.Plot the lines using plot() method.Using savefig() method, we can save the image remotely, just putting the directory.To show the figure, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
273 Views
To plot multiple lines in a diagram, we can use the cycler that could help to set a new color from the given list of colors. (Here, ‘r’ => ‘red’, ‘g’ => ‘green’, ‘y’ => ‘yellow’, ‘b’ => ‘blue’).StepsUse a cycler to set the color for the group of lines. ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
3K+ Views
The following program code shows how you can plot a newline in matplotlib label with Tex.StepsSetup X-axis and Y-axis labels for the diagram with to plot a newline in the labels.Set the current .rcParams for axes facecolor; the group is axed.Use a cycler to set the color for the ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
2K+ Views
We can plot some expressions using the hist method. After that, we will plot the average graph for the expression using the plot method and bins that are returned while creating the hist.StepsGet the data for x using some equations, set num_bins = 50.Create fig and ax variables using subplots ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
767 Views
Using style='plain' in the ticklabel_format() method, we can restrict the value being changed into exponential form.StepsPass two lists to draw a line using plot() method.Use ticklabel_format() method with style='plain'. If a parameter is not set, the corresponding property of the formatter is left unchanged. Style='plain' turns off scientific notation.To show ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
1K+ Views
First, we can create a list of colors, and then, we can use the colors while plotting a line in a loop.StepsReturn evenly spaced numbers over a specified interval, store in x.Update x for four lines and get another variable for evenly_spaced_interval.Make a list of colors.Iterate color and set color ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
301 Views
Using the FuncAnimation method, we can create a film. We will create a user-defined method, update, to keep on changing the position of particles and at the end, the method would return the scatter instance.StepsGet the particles initial position, velocity, force, and size.Create a new figure, or activate an existing ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
2K+ Views
First, we can create fig, ax using subplots() and then, we can plot the lines. After that, using ax.yaxis.set_minor_locator(tck.AutoMinorLocator()), we can turn on the minor ticks.StepsCreate fig and ax variables using subplots method, where default nrows and ncols are 1.Plot the line using two lists.Set the locator of the minor ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
2K+ Views
We can use the attribute sharex = "ax1", and then, use the subplot method to zoom the subplots together.StepsAdd a subplot to the current figure with (nrow = 1, ncols = 2, index = 1).Add line on the current subplot with (nrow = 1, ncols = 2, index = 1).Add ... Read More