Question: Currently, my histogram plot's x-tick labels are [200. 400. 600. 800. 1000. 1200. 1400.]. It represents the rate in dollars. I want to add $ in prefix of these ticks like [$200 $400 $600 $800 $1000 $1200 $1400].

I tried this `axs.xaxis.get_majorticklocs()` to fetch x-tick labels and `axs.xaxis.set_ticks([f"${amount:.0f}" for amount in axs[0, 1].xaxis.get_majorticklocs()])` to set the updated one. I understand that It will throw error as x-tick labels are now string.

Need help! kindly assist how can I do this.

Answer: 
You can do it like this:

```
x = [*range(200,1600,200)]
y = [*range(7)]
fig, ax = plt.subplots()
ax.plot(x,y)
ax.set_xticks(ticks=x, labels=[f"${num}" for num in x])

```

[![enter image description here](https://i.stack.imgur.com/wZyQn.png)](https://i.stack.imgur.com/wZyQn.png)
You might be looking for [`set_xticklabels`](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_xticklabels.html), which says:

> 
> Set the xaxis' labels with list of string labels.
> 
> 
> 

Here you want to set the ticks to `[200. 400. 600. 800. 1000. 1200. 1400.]` and the labels to your string values to ensure it is all aligned.