- 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
6K+ Views
To adjust the size of a matplotlib legend box, we can use borderpad arguments in the legend method.StepsCreate line1 and line2 using two lists with different line widths.To place a legend on the figure and to adjust the size of legend box, use borderpad=2 in legend() method.To display the figure, use show() method.Examplefrom matplotlib import ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
815 Views
To decrease the density of tick labels in subplots in matplotlib, we can assign the minimum value to density.StepsInitialize a variable, density.Create x and y data points using numpy.Plot x and y data points using plot() method.Get or set the current tick locations and labels of the X-axis using xticks() method.To display the figure, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
6K+ Views
To switch axes in matplotlib, we can create a figure and add two subplots using subplots() method. Plot curves, extract x and y data, and set these data in a second plotted curve.StepsCreate x and y data points using numpy.Create a figure and add a set of two subplots.Set the ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
2K+ Views
To place text inside a circle in matplotlib, we can take the following steps −Create a new figure or activate an existing figure using figure() method.Add a subplot method to the current axis.Create a Circle instance using Circle() class.Add a circle path on the plot.To place the text in the circle, we can use text() method.Scale ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
311 Views
To reshape a networkx graph in Python, we can take the following steps −Create a data frame using Panda's data frame.Return a graph from Pandas DataFrame containing an edge list using from_pandas_edgelist() method.Draw the graph G with matplotlib. We can reshape the network by increasing and decreasing the list of keys "from" ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
1K+ Views
To place a circle inside a rectangle, we can take the following steps −Create a new figure or activate an existing figure using figure() method.Add a subplot to the current axis.Create a rectangle and a circle instance.Add a rectangle patch to the current axis.Add a circle patch to the current axis.Scale x and ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
840 Views
To plot and work with NaN values in matplotlib, we can take the following steps −Create data using numpy with some NaN values.Use imshow() method to display data as an image, i.e., on a 2D regular raster, with a colormap and data (from step 1).To display the figure, use show() method.Exampleimport ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
309 Views
To display print statements interlaced with matplotlib plots inline in iPython, we can take the following steps.StepsImport pyplot from matplotlib.Make a list of data for hist plots.Initialize a variable "i" to use in print statement.Iterate the list of data (Step 2).Create a figure and a set of subplots using subplots() method.Place print statement.Plot ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
1K+ Views
To remove relative shift in matplotlib axis, we can take the following steps −Plot a line with two input lists.Using gca() method, get the current axis and then return the X-axis instance. Get the formatter of the major ticker. To remove the relative shift, use set_useOffset(False) method.To display the figure, use show() method.Examplefrom ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
5K+ Views
To define the size of a grid on a plot, we can take the following steps −Create a new figure or activate an existing figure using figure() method.Add an axes to the figure as a part of a subplot arrangement.Plot a curve with an input list.Make x and y margins ... Read More