Answers for "replace axis tick labels matplotlib python"

0

Set axis ticks matplotlib

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker

x = [0,5,9,10,15]
y = [0,1,2,3,4]
fig, ax = plt.subplots()
ax.plot(x,y)
start, end = ax.get_xlim()
ax.set_xticks(np.arange(start, end, 2))
plt.show()
Posted by: Guest on August-19-2021
0

changing axis labels matplotlib

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

labels = [item.get_text() for item in ax.get_xticklabels()]
labels[1] = 'Testing'

ax.set_xticklabels(labels)
Posted by: Guest on May-13-2020

Code answers related to "replace axis tick labels matplotlib python"

Python Answers by Framework

Browse Popular Code Answers by Language