Questions tagged [xticks]

For questions related to xticks in matplotlib, seaborn, or pandas plots.

"xticks" refers mainly to a submodule of the python plotting library matplotlib which handels the ticks of the x axis. But this tag is in general not limited to python or matplotlib but can be used whenever one refers to position and appearance of ticks and marks at the axes of a graph.

255 questions
0
votes
2 answers

Replace xticks with names

I am working on the Spotify dataset from Kaggle. I plotted a barplot showing the top artists with most songs in the dataframe. But the X-axis is showing numbers and I want to show names of the Artists. names =…
0
votes
1 answer

Matplotlib Line vs. Bar plot DateTime axis formatting

I have a DataFrame with a DateTime index: import pandas as pd from random import randrange dates = pd.date_range(start="2020-02-01",end='2020-04-18',freq='1d') df = pd.DataFrame(index=dates,data=[randrange(10000) for i in range(78)] Now when I plot…
germ
  • 1,477
  • 1
  • 18
  • 18
0
votes
1 answer

Matplotlib- make x-ticks the first time of the month on contourf plot

The issue I have a filled contour plot and some time series data with time on the x-axis and height on the y-axis. I made a datetime list and can substitute that in for the x-axis ticks in place of the default list of numbers that usually gets used…
Cebbie
  • 1,741
  • 6
  • 23
  • 37
0
votes
1 answer

Rotate x-axis ticks with twinx plot

I'm trying to rotate the x-axis labels by 90 degrees, which typically works with the last line of the category_amts() function below. However, because this is a dual-axis visual, the approach is not working. How do you rotate axis labels on a…
bshelt141
  • 1,183
  • 15
  • 31
0
votes
1 answer

Adding more months to x-axis on the graph

Here is my code and I have achieve simple graph but I want to elaborate it more. temp_df = pd.read_excel('xTraders_Temperature_Wind.xlsx', sheet_name = 'Temperature') temp_df = temp_df.drop(columns=['Timestamp end']).set_index('Timestamp…
JuniorESE
  • 267
  • 1
  • 7
0
votes
2 answers

Rotation x-ticks matplotlib

I can't seem to get the labels on the x-axis to rotate 90 degrees. Example df: import pandas as pd import matplotlib.pyplot as plt d = ({ 'A' : ['1','1','2','2','3','3','3'], 'B' : ['A','B','C','C','D','B','C'], 'C' :…
user9394674
-1
votes
1 answer

Setting xticks results in only a single tick on the x-axis

I'm using the code below to produce a chart in seaborn. I have included the values for score_train, score_test and alphas so that you could replicate if you try to run my code. alphas = [0.00000000e+00, 3.12213617e-05, 3.41931065e-05,…
Zain
  • 95
  • 6
-1
votes
1 answer

Matplotlib custom ticks and grids in groups

I am trying to insert custom ticks to a plot in batches with defined distances. I can do this by manually adding them, but I am looking for a better way. Example: import matplotlib.pyplot as plt x = [-5, 5] y = [1, 5] plt.plot(x, y) plt.xlim(-10,…
Sooji
  • 3
  • 2
-1
votes
1 answer

How to plot xticks twice

I have just began to write python codes lately and don't have much knowledge. So I have this code that plots a graph using matplotlib and I would like it to mark the xticks twice. But as you may already know the code only results in the second…
-1
votes
1 answer

Show every few X values on x axis (Matplotlib) instead of every value

I am trying to show the x values every couple of months instead of showing all of them. Currently it is showing every value. Which clutters the x axis. Is there an easy way to fix? The x value is formatted as a date. thanks! Here is my code: import…
-1
votes
1 answer

How to decrease amounts of xticks labeled in a plot, when x values are time objects?

Here is my code and plot that I am getting. I want to only have like 5 or 6 xticks but can't seem to do so. import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as md import…
-1
votes
1 answer

How to have equal distance between xticks in python?

From the below figure, we can see that many data points fall in a very close range. That is why I manually set the sticks, but the problem is all the xticks have equal distance between them. Can anyone please tell me how can I have an equal distance…
Animesh Kumar Paul
  • 2,241
  • 4
  • 26
  • 37
-1
votes
1 answer

Reducing xtick interval [Non linear data. Floats]

I have been working on a dataframe plot, where I have 2k values to show and its indexes. However, when I try to plot them, obviously, matplotlib tries to squeeze all the index labels in the axis, making it impossible to read. It looks like this: I…
Rkolay
  • 36
  • 6
-1
votes
1 answer

I have a problem with x tick labels in plotting in python

Why xticklabels do not coincide with the real x_ticks? A=[0.4533333333333333, 0.6033333333333334, 0.7033333333333335, 0.59, 0.49666666666666665, 0.49666666666666665, 0.4166666666666667, 0.7600000000000001] EB_A =[0.04800000000000001, …
Raz
  • 49
  • 11
-1
votes
1 answer

How to adjust xticks labels while plotting

As in the image below, the rotated xticks are ticked in the middle of the label. [1]: https://i.stack.imgur.com/ZE3ew.png Instead, I want it ticked in the end so that there is no overlap. the code to get this…
1 2 3
16
17