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

How do I customize the xticklabels of my figure?

I give the below MWE to describe the kind of customization I would like to apply to my figure. My current df looks like this: df = pd.DataFrame( {'feature': ['abc','bcd','abd','dax','cax','bax','def','deg','abe','cde'], 'score':…
Amina Umar
  • 502
  • 1
  • 9
0
votes
1 answer

How to use set_yticks with ax.loglog

Using matplotlib, I want to eliminate the yticks and ytick labels from a loglog plot. It works for a regular plot, but not for loglog. The following code from matplotlib import pyplot as plt fig, ax =…
0
votes
1 answer

Why isn't imshow displaying correctly when using custom ticks?

I am trying to plot heatmap with average values with x and y axes denote physical parameters. import csv import matplotlib.pyplot as plt from scipy import stats import numpy as…
Parag
  • 41
  • 8
0
votes
1 answer

scatterplot skips major ticks with log scale even with manual spacing

I'm plotting points on a log-log scatterplot with matplotlib. The x coordinate of these points rises twice as fast (exponentially speaking) than the y coordinate, which means that the x axis is twice as densely packed when plotted on a square…
Mew
  • 368
  • 1
  • 11
0
votes
0 answers

Change the axis ticks on Matplotlib.pyplot.imshow() to represent positions instead of pixels

I am trying to create a column density plot of a data set. The data includes the result of a 3D simulation with particles, that have been interpolated on a grid. When I plot with imshow() I get ticks on the x and y axis that represent the pixels…
0
votes
0 answers

Hoe does one move the axis.ticks.x.bottom nearer to my graphic?

Unfortunately I‘m only able to move the label nearer to my axis by using element_text(hjust = 1). But I want to move my ticks nearer to the ordinate. I did not find any function which solve this problem.
0
votes
1 answer

x-axis tick labels unequally distributed after rotation

In this lollipop / stem plot showing an index value for two categories (left/right) per participant, the x labels are unequally distributed in relation to the x-ticks after rotating the labels: Before rotating: x-labels are not legible but centered…
Eva
  • 1
  • 1
0
votes
1 answer

x tick labels in print outside the box when rotated 90 degrees

I'm using a Pandas dataframe to plot a bar graph. The x axis is made up of dates, and I need a lot of x-axis so I rotate them 90 degrees so that they're somewhat readable. However, they're printing outside the box. And even if I try using the…
0
votes
0 answers

How to fix thousands of overlapping xlabels in pyplot

Using a Dataframe to create a plot for stock price and the x-axis is showing everydays close price over the span of the 10 year data Code: df = pd.read_csv("USO.csv") df = df[['Date', 'Close']] df = df.set_index('Date') plt.plot(df.index,…
Yeetle
  • 1
  • 1
0
votes
1 answer

rotating x labels in subplots

this is my code: fig, ax = plt.subplots(1,2, figsize = (30, 8)) g1 = sns.lineplot(data = plsWeekly , x = 'Date', y = 'Close', ax=ax[0]) plt.xticks(rotation=70) g2 = sns.lineplot(data = asxWeekly , x = 'Date', y = 'Close',…
0
votes
2 answers

Set custom xtick labels with pandas plot when using secondary_y

I want to show the x labels rotated 45 degrees. I tired the following code, but it still shows the x labels with 0 rotation. How can the labels be rotated? df_final = pd.DataFrame({'Count':[8601,188497,808,7081,684,15601,75,12325], …
John
  • 99
  • 4
0
votes
1 answer

Minor and major tick marks both in and out on all subplot x-axes

I am having a subplot series where I want to display both minor and major tick marks on all x-axis in inner and outer directions for all of them. I tried something like : fig, ax = plt.subplots(3,figsize=(10,6), sharex=True,…
Py-ser
  • 1,860
  • 9
  • 32
  • 58
0
votes
1 answer

Changing x label values to custom ones in matplotlib pyploy

My code is a little long but it outputs a plot like this one below. I want to change the x axis time values to something custom, like years (2020, 2021, 2022) and want each place it says 40000 or 42000 to be replaced by year. What is the easiest…
Landon
  • 93
  • 11
0
votes
2 answers

I have a dateTime as an index in a dataframe and I want to use just the hour as the xtick label

I have some time series data in a line plot and I want to edit the xticks so they either display the full date or at the very least the hour for each data point. The data is indexed by a dateTime column like this: …
Tom
  • 109
  • 9
0
votes
1 answer

Is there a way to set a lot (10000+) of minor ticks with matplotlib?

I'm trying to plot a signal that lasts 20-30min with 62 samples per second. For visual and research purposes I want the timestamps to scale and change just like the index values do with matplotlib but didn't find a solution to that. After ditching…
ETray
  • 1
  • 1