Rishikesh Kumar Rishi has Published 1156 Articles

How to move labels from bottom to top without adding "ticks" in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:16:03

771 Views

To move labels from bottom to top without adding ticks, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create random data of 5☓5 dimension matrix.Display the data as an image, i.e., on a 2D regular raster using imshow() method.Use tick_params() ... Read More

How to plot masked and NaN values in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:15:39

3K+ Views

To plot masked and NaN values in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Get x2 and y2 data points such that y > 0.7.Get masked y3 data points such that ... Read More

How to Zoom with Axes3D in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:14:51

2K+ Views

To zoom with Axes3D, 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 using figure() method.Get 3D axes object using Axes3D(fig) method.Plot x, y and z data points using scatter() method.To display ... Read More

How to get alternating colours in a dashed line using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:13:44

654 Views

To get alternating colors in a dashed line using Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplotsGet the current axis.Create x and y data points using numpy.Plot x and y data points with "-" and "--" linestyle.To display ... Read More

How to plot a layered image in Matplotlib in Python?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:12:26

1K+ Views

To plot a layered image in Matplotlib in Python, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create dx, dy, x, y and extent data using numpy.Create a new figure or activate an existing figure using figure() method.Create data1 and ... Read More

How to save a plot in Seaborn with Python (Matplotlib)?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:11:59

4K+ Views

To save a plot in Seaborn, we can use the savefig() method.StepsSet the figure size and adjust the padding between and around the subplots.Make a two-dimensional, size-mutable, potentially heterogeneous tabular data.Plot pairwise relationships in a dataset.Save the plot into a file using savefig() method.To display the figure, use show() method.Exampleimport ... Read More

How to remove grid lines from an image in Python Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:11:11

7K+ Views

To remove grid lines from an image, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Load an image from a file.Convert the image from one color space to another.To remove grid lines, use ax.grid(False).Display the data as an image, i.e., ... Read More

How to customize the X-axis in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:10:45

3K+ Views

To customize the X-axis label, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize a variable, N, to get the number of sample data.Create x and y data points using numpyPlot x and y data points using plot() method.Customize the ... Read More

How to customize X-axis ticks in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:04:07

4K+ Views

To customize X-axis ticks in Matplotlib, we can change the ticks length and width.StepsSet the figure size and adjust the padding between and around the subplots.Create lists for height, bars and y_pos data points.Make a bar plot using bar() method.To customize X-axis ticks, we can use tick_params() method, with color=red, ... Read More

How to reverse the colormap of an image to scalar values in Matplotib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Jun-2021 12:02:31

523 Views

To reverse the colormap of an image, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create random data points using x and y.Get the blue color map using get_cmap() method.Add a subplot to the current figure at index 1.Plot x ... Read More

Advertisements