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
3
votes
0 answers

dataframe.plot.bar() does not appear to be handling period indices as 'x' correctly

I have found what appears to me to be a bug in the integration between matplotlib and pandas.DataFrame though it could be I am making a mistake. I have a period of time I want to plot barcharts with bars representing quarterly periods. I want to…
Dan Ward
  • 31
  • 2
3
votes
2 answers

pyplot does not have attribute 'xaxis_set_major_formatter'

I am trying to plot hours in the x-axis [in this picture] using this code #create a lineplot fig = plt.figure(figsize=(20,5)) ax = fig.add_subplot() plt.title('SUBIC-NAIA Air Temp Difference. (C)') ax.plot(date_rng,NASU_dif) monthyearFmt =…
kaelel18
  • 31
  • 1
  • 2
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
3
votes
1 answer

Formatting x axis with per day frequency

I am trying get daily data plot. I have 3 months of data and its really hard to point out each day. How can I format x axis, so that I can get every date?
Dexter
  • 185
  • 1
  • 10
2
votes
1 answer

How to remove a single tick label on a plot, leaving the tick itself

I'd like to remove all but the first and last tick labels, but keep their ticks on a plot. However, using the below code, all labels get removed import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots(1,…
Adriaan
  • 17,741
  • 7
  • 42
  • 75
2
votes
1 answer

xticks and yticks issues while using imshow

I've a problem with fixing the xticks and yticks for the imshow plot. When I use the single plot for imshow then the extent works better (see first figure below). However, when I use to insert the coordinates of the local maxima on the imshow plot…
Alan22
  • 159
  • 10
2
votes
1 answer

How to change xticks of bar chart according to values of first dataframe column?

I have a dataframe that looks like this: data = {'QA Score': [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7], 'Scopus': [0,0,0,0,0,1,0,0,1,3,2,3,6,4,2], 'ResearchGate': [0,0,0,0,0,0,1,1,2,3,2,1,0,2,1], 'Taylor&Francis':…
Luc
  • 35
  • 5
2
votes
1 answer

How can I position tickmarks and axis labels (or ticktext) at the end of bars (rather than centered) in a bar chart using R plotly?

I am trying to create a bar chart that shows how much funds received households of certain income. For that I am using the following code: chart <- plot_ly(funds, x = ~income_group, y = ~FundsSent, …
juanscar
  • 21
  • 3
2
votes
1 answer

How to set ticks in Seaborn FacetGrid?

I have a code like this, and I want to add ticks on the X-axis so I could see better what the value over 150 corresponds to, for example. the range for my X-values is from 178 to 17639. bins = np.linspace(df.days_with_cr_line.min(),…
Bluetail
  • 1,093
  • 2
  • 13
  • 27
2
votes
1 answer

How to rotate specific tick labels

Use case: you have tick marks on the x axis. But some ticks are either too close or you need to otherwise emphasize them via rotation. So, for example, you might have a list of dates across the x axis that are always first of the month. But then you…
George Hayward
  • 485
  • 5
  • 12
2
votes
1 answer

Change frequency of ticks matplotlib

I am trying to lower the frequency of the xticks so that its more readable, but I am not able to do so when the x ticks are not integers. Please see example below (matplotlib 2.1.1): f = plt.figure(figsize=(5, 5)) ax1 = f.add_subplot(211) ax2 =…
user1179317
  • 2,693
  • 3
  • 34
  • 62
2
votes
1 answer

Adding grouping ticks to a bar chart

I have a chart created from a pandas DataFrame that looks like this: I've formatted the ticks with: ax = df.plot(kind='bar') ax.set_xticklabels(df.index.strftime('%I %p')) However, I'd like to add a second set of larger ticks, to achieve this kind…
Grismar
  • 27,561
  • 4
  • 31
  • 54
2
votes
0 answers

Matplotlib - place ticks exactly where discrete colors change

I am trying to plot a colorbar that uses a limited number of colors (discrete). The problem is that the colors don't change where the major and minor ticks appear. The issue is worse with a log scale (which is what I need), but also happen with a…
hbarbosa
  • 101
  • 3
2
votes
0 answers

twinx non-linear mapping between shared y axes on a plot in matplotlib

I have some 3d data that I am plotting with pcolormesh. On the x-axis is time, on the y-axis is height. The height has a potential (E) associated with it, but the mapping from height (y) to potential (E) is non-linear. I want to add an axis on the…
FluidFox
  • 107
  • 10
2
votes
1 answer

Matplotlib 3.3.3: Changing the color of single ticks not working anymore

I upgraded to matplotlib 3.3.3 and I can no longer change the color of a single tick when plotting. Using matplotlib 3.2.1 the following code import matplotlib.pyplot as plt plt.ylim(0,3) ax = plt.gca() y_label_positions =…
Broetsch
  • 23
  • 3
1 2
3
16 17