Rishikesh Kumar Rishi has Published 1162 Articles

Matplotlib – Drawing lattices and graphs with Networkx

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 13:19:25

954 Views

To draw lattices and graphs with networkx, we can take the following steps −Import networkx and pyplot.Set the figure size and adjust the padding between and around the subplots.Use nx.grid_2d_graph(3, 3) to get a two-dimensional grid graph. The grid graph has each node connected to its four nearest neighbors.Draw the ... Read More

How to set the border color of the dots in matplotlib's scatterplots?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 13:07:59

4K+ Views

To set the border color of the dots in matplotlib scatterplots, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize a variable "N" to store the number of sample data.Create x and y data points using numpy.Plot the x and ... Read More

How to determine the order of bars in a matplotlib bar chart?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 13:01:06

5K+ Views

To determine the order of bars in a bar chart in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a dataframe, df, of two-dimensional, size-mutable, potentially heterogeneous tabular data.Add a subplot to the current figure.Make a bar plot ... Read More

How to make a rug plot in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 10:37:03

617 Views

Rug plots are used to visualize the distribution of data. It is a plot of data for a single variable, displayed as marks along an axis. To make a rug plot in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around ... Read More

How to fill rainbow color under a curve in Python Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 09:54:32

546 Views

To fill rainbow color under a curve in Python Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a user-defined method, plot_rainbow_under_curve(), that could have a list of 7 rainbow colors and create a set of data points "x" ... Read More

How to draw axis lines inside a plot in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 09:38:32

402 Views

To draw axis lines inside a plot in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure.Create x data points using numpy.Add an 'ax' to the figure as part of a ... Read More

How to set same scale for subplots in Python using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 09:32:07

3K+ Views

To set the same scale for subplot in Python using Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure.Add an 'ax1' to the figure as part of a subplot arrangement with ... Read More

Conditional removal of labels in Matplotlib pie chart

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 09:29:16

2K+ Views

To remove labels from a Matplotlib pie chart based on a condition, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a Pandas dataframe of wwo-dimensional, size-mutable, potentially heterogeneous tabular data.Plot a pie chart, using pie() method with conditional removal ... Read More

Matplotlib – Make a Frequency histogram from a list with tuple elements in Python

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 09:23:49

2K+ Views

To make a frequency histogram from a list with tuple elements in Python, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a list of tuples, data.Make lists of frequency and indices, after iterating the data.Make a bar plot usig ... Read More

How to rotate a simple matplotlib Axes?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 20-Sep-2021 09:18:12

9K+ Views

To rotate a simple matplotlib axes, we can take the following steps −Import the required packages −import matplotlib.pyplot as plt from matplotlib.transforms import Affine2D import mpl_toolkits.axisartist.floating_axes as floating_axesSet the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure.Make a tuple ... Read More

Advertisements