For questions related to yticks in matplotlib, seaborn, or pandas plots.
Questions tagged [yticks]
30 questions
753
votes
14 answers
Changing the tick frequency on the x or y axis
I am trying to fix how python plots my data. Say:
x = [0, 5, 9, 10, 15]
y = [0, 1, 2, 3, 4]
matplotlib.pyplot.plot(x, y)
matplotlib.pyplot.show()
The x axis' ticks are plotted in intervals of 5. Is there a way to make it show intervals of 1?

Dax Feliz
- 12,220
- 8
- 30
- 33
563
votes
6 answers
Plot logarithmic axes
I want to plot a graph with one logarithmic axis using matplotlib.
I've been reading the docs, but can't figure out the syntax. I know that it's probably something simple like 'scale=linear' in the plot arguments, but I can't seem to get it…
Jim
310
votes
13 answers
Modify tick label text
I want to make some modifications to a few selected tick labels in a plot.
For example, if I do:
label = axes.yaxis.get_major_ticks()[2].label
label.set_fontsize(size)
label.set_rotation('vertical')
the font size and the orientation of the tick…

repoman
- 3,485
- 2
- 16
- 15
124
votes
3 answers
Change grid interval and specify tick labels
I am trying to plot counts in gridded plots, but I haven't been able to figure out how to go about it.
I want:
to have dotted grids at an interval of 5;
to have major tick labels only every 20;
for the ticks to be outside the plot; and
to have…

owl
- 1,841
- 6
- 20
- 30
108
votes
6 answers
how to turn on minor ticks only on y axis
How can I turn the minor ticks only on y axis on a linear vs linear plot?
When I use the function minor_ticks_on to turn minor ticks on, they appear on both x and y axis.

emad
- 2,869
- 3
- 18
- 18
99
votes
8 answers
Format axis offset-values to whole numbers or specific number
I have a matplotlib figure which I am plotting data that is always referred to as nanoseconds (1e-9). On the y-axis, if I have data that is tens of nanoseconds, ie. 44e-9, the value on the axis shows as 4.4 with a +1e-8 as an offset. Is there…

Jonathan
- 1,205
- 1
- 10
- 12
99
votes
5 answers
How to force integer tick labels
My python script uses matplotlib to plot a 2D "heat map" of an x, y, z dataset. My x- and y-values represent amino acid residues in a protein and can therefore only be integers. When I zoom into the plot, it looks like this:
As I said, float values…

gha
- 3,459
- 3
- 18
- 13
5
votes
1 answer
Arguments for LogLocator
In MatPlotLib, I want to plot a graph with a linear x-axis and a logarithmic y-axis. For the x-axis, there should be labels at multiples of 4, and minor ticks at multiples of 1. I have been able to do this using the MultipleLocator class.
However, I…

Karnivaurus
- 22,823
- 57
- 147
- 247
3
votes
1 answer
How to add minor ticks
I want to add minor ticks on the y axis. I tried several methods but they all seem to not work. The minor ticks just won't show up.
Here is my code.
sns.set_style('whitegrid')
dd.plot(x='Date', y='Min', lw = 4, figsize=(50,30), color = 'red')
…

moinabyssinia
- 163
- 1
- 2
- 9
1
vote
1 answer
tick_params doesn't work properly for 2nd y-axis
I am designing a GUI in which whenever I click a button, the figure inside the GUI will be updated. This figure contains two y-axes with a common x-axis. I am using twinx function inside matplotlib. Everything is working as expected, except the…

Rex
- 13
- 1
- 6
1
vote
1 answer
Setting xtick labels in of an sns.heatmap subplot
I am trying to put 3 subplots of sns.heatmap with custom xticklabels and yticklabels. You can see that the labels I enter overlaps with some default labels. How to avoid this?
glue = sns.load_dataset("glue").pivot("Model", "Task",…

volkan g
- 186
- 10
1
vote
0 answers
Is a there a step value parameter in sns.scatterplot( ) function?
I used sns.scatterplot() function to find relationship between City mileage and price of cars dataset but in the y axis the limits are all collapsed and I couldn't find the proper limit in y axis.
I tried using
plt.ylim(0,700000,100000)
but that…

Perfect Paws
- 11
- 1
1
vote
1 answer
Increase the number of minor ticks
When I turn on minor ticks in a plot with something like plt.minorticks_on(), I often want to have a larger number of minor ticks.
Is there a simple method to achieve that?

drevicko
- 14,382
- 15
- 75
- 97
1
vote
1 answer
Rotating 2nd y-axis tick labels
I need to rotate the 2nd y-axis ticklabel and add a label for this axis as well in the figure below
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import matplotlib.transforms as mtransforms
fig, ax1 =…

Ahmed Attia
- 153
- 1
- 8
0
votes
0 answers
Plotly not saving tick format correctly
I am building a figure with 2 yaxis (yaxis1 and yaxis2). Both of the yaxis are logarithmic, but the yaxis2 has specific tick formatting, with tickmode = 'array'. The figure appears fine in my Jupyter Notebook, but not when I save it as .pdf, .png,…

JJC
- 1