- 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
268 Views
To configure the behaviour of the backend, we can use matplotlib.rcParams['backend'] with a new backend name.StepsUse get_backend() method to get the backend name.Override the existing backend name using matplotlib.rcParams.Use get_backend() method to get the configured backend name.Exampleimport matplotlib backend = matplotlib.get_backend() print("The current backend name is: ", backend) matplotlib.rcParams['backend'] = ... Read More
Rishikesh Kumar Rishi
716 Views
We can change the strength of antialiasing by using True or False flag in the argument of plot() method.StepsCreate x data points and colors list with different colors.Defining a method that accepts antialiased flag and axis.We can iterate in the range of 5, to print 5 different colors of curves from ... Read More
Rishikesh Kumar Rishi
468 Views
Meshgrid − Coordinate matrices from coordinate vectors.Let's take an example to see how we can apply a function to a Python meshgrid. We can consider two lists, x and y, using numpy vectorized decorator.Exampleimport numpy as np @np.vectorize def foo(a, b): return a + b x = [0.0, 0.5, ... Read More
Rishikesh Kumar Rishi
238 Views
Using plt.figure(), we can create multiple figures and to close them all explicitly, call plt.close(). If you are creating many figures, make sure you explicitly call pyplot.close on the figures you are not using, because this will enable pyplot to properly clean up the memory.Using subplots(), we can create a figure ... Read More
Rishikesh Kumar Rishi
5K+ Views
To adjust transparency, i.e., aplha in Seaborn pairplot, we can change the value of alpha.StepsCreate a dataframe using Pandas with two keys, col1 and col2.Initialize the variable, alpha, for transparency.Use pairplot() method to plot pairwise relationships in a dataset. Use df (from step 1), kind="scatter", and set the plot size, ... Read More
Rishikesh Kumar Rishi
4K+ Views
To retrieve XY data from a matplotlib figure, we can use get_xdata() and get_ydata() methods.StepsCreate x and y data points using numpy.Limit X and Y axes range, using xlim() and ylim() methods.Plot xs and ys data points using plot() method with marker=diamond, color=red, and markersize=10, store the returned tuple in a line.Use get_xdata() and get_ydata() methods ... Read More
Rishikesh Kumar Rishi
1K+ Views
To let my matplotlib plot go beyond the axes, we can turn off the flag clip_on in the argument of plot() method.StepsCreate xs and ys data points using numpy.Limit the X and Y axis range in the plot to let the line go beyond this limit, using xlim() and ylim() ... Read More
Rishikesh Kumar Rishi
7K+ Views
To avoid overlapping of labels and autopct in a matplotlib pie chart, we can follow label as a legend, using legend() method.StepsInitialize a variable n=20 to get a number of sections in a pie chart.Create slices and activities using numpy.Create random colors using hexadecimal alphabets, in the range of 20.Use pie() method ... Read More
Rishikesh Kumar Rishi
817 Views
To fix colors in scatter plots in matplotlib, we can take the following steps −Create xs and ys random data points using numpy.Create a set of colors using hexadecimal alpabets, equal to the length of ys.Plot the lists, xs and ys, using scatter() method, with the list of colors.To display ... Read More
Rishikesh Kumar Rishi
2K+ Views
To plot two countplot graphs side by side in Seaborn, we can take the following steps −To create two graphs, we can use nrows=1, ncols=2 with figure size (7, 7).Create a dataframe with keys, col1 and col2, using Pandas.Use countplot() to show the counts of observations in each categorical bin ... Read More