- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 set the ticks on a Fixed Position in Matplotlib?
To set the ticks on a fixed position in matplotlib, we can take the following steps −
Create a figure and add a set of subplots.
To set the ticks on a fixed position, create two lists with some values.
Use set_yticks and set_xticks methods to set the ticks on the axes.
To display the figure, use show() method.
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots() xtick_loc = [0.20, 0.75, 0.30] ytick_loc = [0.12, 0.80, 0.76] ax.set_xticks(xtick_loc) ax.set_yticks(ytick_loc) plt.show()
- How to set the number of ticks in plt.colorbar in Matplotlib?
- How to turn on minor ticks only on the y-axis Matplotlib?
- How can I set the location of minor ticks in Matplotlib?
- CSS position: fixed;
- How to set axis ticks in multiples of pi in Python Matplotlib?
- How to add Matplotlib Colorbar Ticks?
- How to change the spacing between ticks in Matplotlib?
- How to disable the minor ticks of a log-plot in Matplotlib?
- How to customize X-axis ticks in Matplotlib?
- How to create minor ticks for a polar plot in matplotlib?
- How to change the color of the ticks in the colorbar in Matplotlib?
- How to add third level of ticks in Python Matplotlib?
- How to remove the digits after the decimal point in axis ticks in Matplotlib?
- How to change the color of the axis, ticks and labels for a plot in matplotlib?
- How to shift the colorbar position to right in matplotlib?