- 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
568 Views
Example − In the given tree, the root node is 1, the root of its left sub tree is 2, and the root of its right sub tree is 3, ... so on.Preorder Tree Traversal Output: 1, 2, 4, 5, 3, 6, 7.Approach to solve this problemStep 1 − First, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
1K+ Views
Matplotlib can wrap text automatically, but if it's too long, the text will be displayed slightly outside of the boundaries of the axis anyways.StepsCreate a new figure, or activate an existing figure, using figure().Set the axis properties using plt.axis() method.Make a variable input_text to store the string.Add text to figure, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
9K+ Views
First, we can calculate the mean and standard deviation of the input data using Pandas dataframe.Then, we could plot the data using Matplotlib.StepsCreate a list and store it in data.Using Pandas, create a data frame with data (step 1), mean, std.Plot using a dataframe.To show the figure, use plt.show() method.Exampleimport ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
12K+ Views
First, we can create a scatter for different data points using the scatter method, and then, we can plot the lines using the plot method.StepsCreate a new figure, or activate an existing figure with figure size(4, 3), using figure() method.Add an axis to the current figure and make it the ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
5K+ Views
First, we can make two lists of x and y, where the values will be more than 1000. Then, we can use the ax.yaxis.set_major_formatter method where can pass StrMethodFormatter('{x:, }') method with {x:, } formatter that helps to separate out the 1000 figures from the given set of numbers.StepsMake two ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
14K+ Views
Just using the savefig method of the pyplot package and mentioning the file format, we can save the output as a SVG format.StepsCreate fig and ax variables using subplots method, where default nrows and ncols are 1.Create xpoints and ypoints using np.array(0, 5).Plot lines using xpoints and ypoints.Set the X-axis ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
830 Views
Using the figsize attribute of figure(), we can change the figure size. To change the format of a figure, we can use the savefig method.StepsStore the figure size in the variable.Create a new figure, or activate an existing figure, with given figure size.Plot the line using x.Set the image title ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
3K+ Views
Just by using plt.ylabel(rotation='horizontal'), we can align a label according to our requirement.StepsPlot the lines using [0, 5] and [0, 5] lists.Set the y-label for Y-axis, using ylabel method by passing rotation='horizontal'.Set the x-label for X-axis, using xlabel method.To show the plot, use plt.show() method.Examplefrom matplotlib import pyplot as plt ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
3K+ Views
By creating a 3D projection on the axis and iterating that axis for different angles using view_init(), we can rotate the output diagram.StepsCreate a new figure, or activate an existing figure.Add an `~.axes.Axes` to the figure as part of a subplot arrangement with nrow = 1, ncols = 1, index ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
8K+ Views
First, we can create bars using plt.bar and using xticks. Then, we can align the labels by setting the “vertical” or “horizontal” attributes in the “rotation” key.StepsMake lists, bars_heights, and bars_label, with numbers.Make a bar plot using bar() method, with bars_heights and length of bars_label.Get or set the current tick ... Read More