- 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
5K+ Views
To darken and lighten the color, we can chage the alpha value in the argument of plot() method.Greater the aplha value, darker will be the color.StepsCreate data points for xs and ys using numpy.Plot two lines with different value of alpha, to replicate darker and lighter color of the linesPlace ... Read More
Rishikesh Kumar Rishi
8K+ Views
To change the range of the X-axis with datetimes in matplotlib, we can take the following steps −Create a list of x and y, where x stores the datetime and y stores the number.Using subplots method, create a figure and add a set of subplots.Plot x and y data points using plots() method, wehere markerface ... Read More
Rishikesh Kumar Rishi
2K+ Views
To change the plot line color from blue to black, we can use setcolor() method−StepsCreate x and y data points using numpy.Plot line x and y using plot() method; store the returned value in line.Set the color as black using set_color() method.To display the figure, use show() method.Exampleimport numpy as ... Read More
Rishikesh Kumar Rishi
3K+ Views
To determine the axis size in pixels, we can take the following steps −Create a figure and a set of subplots, using subplots() method, fig and ax.To get the DPI, use fig.dpi. Print the details.Find bounding box in the display box.Find the width and height, using bbox.width and bbox.height.Print the width and ... Read More
Rishikesh Kumar Rishi
218 Views
To make a multicolored point in matplotlib, we can take the following steps−Initialize two varuables, x and y.Use scatter method with x and y data points with green color having marker size 2000.Use scatter method with x and y data points with red color having marker size 1000.Use scatter method ... Read More
Rishikesh Kumar Rishi
6K+ Views
To add percentages on top of bars in Seaborn, we can take the following steps −Create the lists, x, y and percentages to plot using Seaborn.Using barplot, show point estimates and confidence intervals with bars. Store the returned axis.Find patches from the returned axis (In step 2).Iterate the patches (returned in ... Read More
Rishikesh Kumar Rishi
792 Views
To decouple hatch and edge color in matplotlib, we can use hatch color “o” and edge color “red”.−StepsCreate a new figure or activate existing figure.Add a subplot arrangement to the current axes.Create two lists of data points.Use bar() method with hatch and edgecolor.To display the figure, use show() method.Exampleimport matplotlib.pyplot ... Read More
Rishikesh Kumar Rishi
562 Views
To fix the extension of margin at the bottom of a figure, we can take the following steps −Using Pandas dataframe, create a df with the keys, time and speed.Plot df.time and df.speed using plot() method.Tick_params() is a convenience method for changing the appearance of ticks and tick labels. rotation=90 extends the tick ... Read More
Rishikesh Kumar Rishi
2K+ Views
To set the background color on specific areas of a pyplot, we can take the following steps −Using subplots() method, create a figure and a set of subplots, where nrows=1.Using rectangle, we can create a rectangle, defined via an anchor point and its width and height. Where, edgecolor=orange, linewidth=7, and ... Read More
Rishikesh Kumar Rishi
10K+ Views
To set the xlabel at the end of X-axis in matplotlib, we can take the following steps −Create data points for x using numpy.Using subplot() method, add a subplot to the current figure.Plot x and log(x) using plot() method.Set the label on X-axis using set_label() method, with fontsize=16, loc=left, and color=red.To set the xlabel at the end ... Read More