- 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
22K+ Views
To add legends in a subplot, we can take the following Steps −Using numpy, create points for x, y1, y2 and y3.Create a figure and a set of subplots, using the subplots() method, considering 3 subplots.Plot the curve on all the subplots(3), with different labels, colors. To place the legend ... Read More
Rishikesh Kumar Rishi
20K+ Views
To plot multiple graphs in matplotlib, we will use the following steps −StepsCreate x, y1 and y2 data points using numpy.Add a subplot to the current figure at index 1.Plot curve 1 using x and y1.Add a subplot to the current figure at index 2.Plot curve 2 using x and y2.To display the figure, ... Read More
Rishikesh Kumar Rishi
25K+ Views
We can change the color of the axis, ticks and labels, using ax.spines['left'].set_color('red') and ax.spines['top'].set_color('red') statements. To change the color of the axis, ticks, and labels for a plot in matplotlib, we can take the following steps −Create a new figure, or activate an existing figure, using plt.figure().Add an axis ... Read More
Rishikesh Kumar Rishi
21K+ Views
To save Pandas DataFrames into multiple excel sheets, we can use the pd.ExcelWriter() method. Make sure you have the openpyxl package installed before using ExcelWriter().StepsCreate a two-dimensional, size-mutable, potentially heterogeneous tabular data, df1.Print the input DataFrame, df1.Create another DataFrame, df2, and print it.Use ExcelWriter() method to write the given formatted ... Read More
Rishikesh Kumar Rishi
27K+ Views
To write text in subscript in the axis labels and the legend, we can take the following steps −Create x and y data points using NumPy.Plot x and y data points with a super subscript texts label.Use xlabel and ylabel with subscripts in the text.Use the legend() method to place a legend ... Read More
Rishikesh Kumar Rishi
29K+ Views
Using the following methods, we can clear the memory occupied by Matplotlib plots.plt.figure() - Create a new figure or activate an existing figure.plt.figure().close() - Close a figure window.close() by itself closes the current figureclose(h), where h is a Figure instance, closes that figureclose(num) closes the figure number, numclose(name), where name is ... Read More
Rishikesh Kumar Rishi
25K+ Views
First, we can define our dictionary and then, convert that dictionary into keys and values. Finally, we can use the data to plot a bar chart.StepsCreate a dictionary, i.e., data, where milk and water are the keys.Get the list of keys of the dictionary.Get the list of values of the ... Read More
Rishikesh Kumar Rishi
30K+ Views
To get a value from the cell of a DataFrame, we can use the index and col variables.StepsCreate a two-dimensional, size-mutable, potentially heterogeneous tabular data, df.Print the input DataFrame, df.Initialize the index variable.Initialize the col variable.Get the cell value corresponding to index and col variable.Print the cell value.Example Live Demoimport pandas ... Read More
Rishikesh Kumar Rishi
29K+ Views
To select all columns except one column in Pandas DataFrame, we can use df.loc[:, df.columns != ].StepsCreate a two-dimensional, size-mutable, potentially heterogeneous tabular data, df.Print the input DataFrame, df.Initialize a variable col with column name that you want to exclude.Use df.loc[:, df.columns != col] to create another DataFrame excluding a ... Read More
Rishikesh Kumar Rishi
29K+ Views
To plot multiple boxplots in one graph in Pandas or Matplotlib, we can take the following steps −StepsSet the figure size and adjust the padding between and around the subplots.Make a Pandas data frame with two columns.Plot the data frame using plot() method, with kind='boxplot'.To display the figure, use show() ... Read More