- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
How to move labels from bottom to top without adding "ticks" in Matplotlib?
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() method to move labels from bottom to top.
- To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True data = np.random.rand(5, 5) plt.imshow(data, cmap="copper") plt.tick_params(axis='both', which='major', labelsize=10, labelbottom=False, bottom=True, top=False, labeltop=True) plt.show()
Output
- Related Articles
- Adding extra axis ticks using Matplotlib
- How to move the Y-axis ticks from the left side of the plot to the right side in matplotlib?
- Set the JSlider vertical and move bottom-to-top in Java
- Make the JSlider vertical and move top-to-bottom in Java
- How to change the color of the axis, ticks and labels for a plot in matplotlib?
- How to show tick labels on top of a matplotlib plot?
- How to better rasterize a plot without blurring the labels in matplotlib?
- How to add Matplotlib Colorbar Ticks?
- How to remove a frame without removing the axes tick labels from a Matplotlib figure in Python?
- Create a graph using ggplot2 without axes ticks and axes labels.
- Adding value labels on a matplotlib bar chart
- Create a ggplot2 graph without axes labels, axes titles and ticks in R.
- How to customize X-axis ticks in Matplotlib?
- How to change the spacing between ticks in Matplotlib?
- 10 Common Digestive Conditions from Top to Bottom

Advertisements