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
1 answer

How to remove the first and last minor tick month labels on matplotlib?

I want to generate a chart with the 12 months of a year as the x-axis labels, i.e. 'Jan' to 'Dec', positioned in the middle between the major ticks. I used the code from https://matplotlib.org/3.4.3/gallery/ticks_and_spines/centered_ticklabels.html…
0
votes
1 answer

Changing tick frequency for x-axis in a two y-axis with imported data from .csv

Hello I'm importing my data from a .csv file and plotting it in a graph with two y-axis. The x-axis are Timestamps and I'd like to have less of them, since it looks really clutered (new here and can't post pictures yet). I tried using…
snkm
  • 3
  • 3
0
votes
0 answers

limit the number of ticks on time series x axis (d3)

Trying to create a bar chart with Time type on x axis. I want to only display few ticks on x axis. Below is a small portion of the code. After reading many posts online, I realized I need to use tickValues and also to Time format them. However,…
baharak Al
  • 71
  • 1
  • 10
0
votes
1 answer

(Chart.js 3.7.0) change position of x-axis ticks to alternate between each tick?

I have a chart which effectively renders a timeline, but sometimes the tick positions are too close together Current graph (padding: 25) I can change the padding to be negative which puts them above the x-axis: Ticks above x-axis (padding: -60) But…
0
votes
0 answers

xtics, arrange values to specific values

So I have created a graph where my x-axis is in dates. My struggle is that I've used the code np.arange(0,160,30) and then plt.xticks(np.arange(0,160,30),labels=x[np.arange(0,160,30)]) to separate the axis into months. But as we know, the months…
0
votes
0 answers

AttributeError: 'AxesSubplot' object has no property 'axes_class' when trying to left align ticks of the y axis of a plot

I'm trying to left align ticks of the y axis of a plot and copied the code on the matplotlib documentation but I get an error message AttributeError: 'AxesSubplot' object has no property 'axes_class' with matplotlib==3.3.3 and Python 3.8.7 import…
ecjb
  • 5,169
  • 12
  • 43
  • 79
0
votes
0 answers

Setting xticklabels and x-axis limits in a bar plot

I want to plot a bar graph with a variable amount of values along the x-axis. For the data, I have a set of labels which I want to show on the x-axis under the bars. I also want the x-axis limits to start at -1, since otherwise, only half of the…
drdolphin
  • 117
  • 1
  • 6
0
votes
0 answers

How can I add tick labels in NetworkX?

I am new to python and NetworkX and I'm facing trouble naming my ticks on the y-axis. I tried using plt.yticks() and ax.set_ylabels() but it does not label all the ticks. This is the code: fig, ax = plt.subplots(figsize=(10,…
0
votes
0 answers

Why I am getting two different plots for same data?

I have a data file. (duration : One day) I want to plot time vs temp graph. I tried to plot it using two different block of codes. The methods are standard but I am getting two different plots. In first method I used time in datetime…
vgb_backup
  • 49
  • 1
  • 6
0
votes
1 answer

Rotate xticks in subplots (xticklabels rotation)

I have a figure with four subplots in it. I want to rotate the xticks of all suplots by 45 degrees. As per this question, I believe this can be done with plt.setp(). # Create subplots fig, ax = plt.subplots(2, 2, figsize=(10,5), sharex=True,…
Arturo Sbr
  • 5,567
  • 4
  • 38
  • 76
0
votes
1 answer

Matplotlib - add labelled ticks to axis

How can one add additional labelled ticks to an axis? For example: import matplotlib.pyplot as plt import numpy as np x = np.arange(0,10) # random function to plot y = np.exp(-x) fig, axs = plt.subplots(1,1)…
reloh100
  • 65
  • 1
  • 8
0
votes
1 answer

How to set a maximum number of x-ticks in matplotlib

I am trying to plot two long time series in matplotlib. Since I am not going to need any subplot, I did not use the figure.add_subplot() method. fig =…
0
votes
1 answer

Evenly space for x-ticks in Matplotlib

I need to plot a graph like this style, where the x-ticks have evenly space in the range of [0.1, 1, 10, 100, 1000]. My code looks like this: x = np.array([0.3081, 1.2, 29.4, 29.4, 54.7, 29.4, 14.7, 7.8, 54.7, 68.0]) y =np.array( [94.92, 94.85,…
0
votes
1 answer

Xticks not showing at all

I wonder why my graph is not showing any xticks at all? my code: ax = df.plot(x='A', y='B', marker = 'D', markersize=4) ax.set_xbound(lower=-40, upper=40) plt.xticks(np.arange(40, -40, 4), rotation=90)
chen abien
  • 257
  • 1
  • 6
0
votes
1 answer

Bar Chart in Time Series goes on beyond the last date after DateFormatter and WeekdayLocator are applied

So, my task is pretty simple. I need to draw both bar and stacked bar charts for two columns in Time Series. I draw them, everything is nice, but because of the large range of dates, dates can not be distinguished. Only the start and end dates are…
user15934571