One way to achieve uneven tick intervals on the Y-axis is to specify the tick locations and labels manually. This can be done using the yticks()
function in pyplot (if using Matplotlib) or the scale_y_continuous()
function in ggplot2 (if using R).
For example, in Matplotlib, the following code sets tick locations at [0, 10, 20, 40, 60], and corresponding tick labels as ["0", "10-20", "20-40", "40-60", ">60"]:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4, 5], [5, 15, 25, 45, 70])
plt.yticks([0, 10, 20, 40, 60], ["0", "10-20", "20-40", "40-60", ">60"])
plt.show()
This produces a graph with tick intervals that are uneven:
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-05 13:38:10 +0000
Seen: 14 times
Last updated: May 05 '23
What is the method for determining the mean and variance of two intervals?
What is the process for calculating percentiles within specific time intervals?
What is the method for altering the color of the input text in a TextFormField in Flutter?
What is the procedure for utilizing the node-rdpjs library?
What is the method to change a PDF file to an Excel file using C#?
What is the method to make a TextButton inactive when the text field has no text?
What is the method to alter the background image in HTML?
What is the method for saving an entity with @EmbeddedId as its primary key in Hibernate?
What is the method to superimpose two seaborn density plots?