- 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
1K+ Views
To imporove the label placement for matplotlib scatter chart, we can first plot the scatter points and annotate those points with labels.StepsCreate points for x and y using numpy.Create labels using xpoints.Use scatter() method to scatter points.Iterate the labels, xpoints and ypoints and annotate the plot with label, x and y with different properties.To ... Read More
Rishikesh Kumar Rishi
1K+ Views
To plot bar graphs with same X coordinates (G1, G2, G3, G4 and G5), side by side in matplotlib, we can take the following steps −Create the following lists – labels, men_means and women_means with different data elements.Return evenly spaced values within a given interval, using numpy.arrange() method.Set the width variable, ... Read More
Rishikesh Kumar Rishi
487 Views
To plot scatter points using plot method in matplotlib, we can take the following steps−Create random data points (x1 and x2) using numpy.Plot x1 data points using plot() method with marker size 20 and green color.Plot x2 data points using plot() method with marker size 10 and red color.Exampleimport numpy ... Read More
Rishikesh Kumar Rishi
6K+ Views
To change the formatting of a datetime axis in matplotlib, we can take the following steps−Create a dataframe df using pandas DataFrame with time and speed as keysCreate a figure and a set of subplots using subplots() method.Plot the dataframe using plot method, with df's (Step 1) time and speed.To ... Read More
Rishikesh Kumar Rishi
4K+ Views
To save a figure as a file from iPython, we can take the following steps−Create a new figure or activate an existing figure.Add an axes to the figure using add_axes() method.Plot the given list.Save the plot using savefig() method.Examplefrom matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = ... Read More
Rishikesh Kumar Rishi
3K+ Views
To plot 2D math vectors with matplotlib, we can take the following steps−Create vector cordinates using numpy array.Get x, y, u and v data points.Create a new figure or activate an existing figure using figure method.Get the current axis using gca() method.Set x an y limits of the axes.To redraw ... Read More
Rishikesh Kumar Rishi
868 Views
To wrap long Y label in matplotlib tight layput using setp, we can take the following steps−Create a list of a long strings.Create a tuple of 3 values.Create a figure and add a set of subplots.Limit the Y-axis ticks using ylim() method.Make a horizontal bar plot, using barh() method.Use yticks() ... Read More
Rishikesh Kumar Rishi
381 Views
To create a standard colorbar for a series of plots, we can take the following steps −Create random data using numpy.Create a figure and a set of subplot using subplots() method, where nrows=1 and ncols=1.Display data as an image.Add an axes to the figure, for colorbar.Create a colorbar where mappable ... Read More
Rishikesh Kumar Rishi
3K+ Views
To get a list of all the fonts currently available for matplotlib, we can use the font_manager.findSystemFonts() method.StepsPrint a statement.Use font_manager.findSystemFonts() method to get a list of fonts availabe.Examplefrom matplotlib import font_manager print("List of all fonts currently available in the matplotlib:") print(*font_manager.findSystemFonts(fontpaths=None, fontext='ttf'), sep="")Output/usr/share/fonts/truetype/Nakula/nakula.ttf /usr/share/fonts/truetype/ubuntu/Ubuntu-L.ttf /usr/share/fonts/truetype/tlwg/Loma-BoldOblique.ttf ................................................................. ............................................................................ ................................................................................. ........ ... Read More
Rishikesh Kumar Rishi
7K+ Views
To place a top label for colorbars, we can use colorbar's axis to set the title.StepsCreate random data using numpy.Use imshow() method to represent data into an image, with colormap "PuBuGn" and interpolation= "nearest".Create a colorbar for a scalar mappable instance, imSet the title on the ax (of colorbar) using ... Read More