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

How to decrease the ticks labels frequency but not total number of ticks?

I would like to show the y values every 0.5 units, but leave the ticks frequency as it is now. How can I do it? This is my code: #plotting ax1.errorbar('Sampling', 'y', data=df3_sub_DP) ax2 = ax1.twinx() # instantiate a second axes that shares the…
1
vote
0 answers

Matplotlib first and last minor tick not appearing on plot

In matplotlib (version 3.2.2), I want to put minor ticks on a plot. However, when the axis limits are multiples of the minor tick stepsize, the first and sometimes last minor ticks are not plotted. Below is a minimal example with output plots. I…
bproxauf
  • 1,076
  • 12
  • 23
1
vote
2 answers

Make geom_histogram display x-axis labels as integers instead of numerics

I have a data.frame that has counts for several groups: set.seed(1) df <- data.frame(group = sample(c("a","b"),200,replace = T), n = round(runif(200,1,2))) df$n <- as.integer(df$n) And I'm trying to display a histogram of df$n,…
dan
  • 6,048
  • 10
  • 57
  • 125
1
vote
1 answer

fix xticks starting from 1 in python with matplotlib

I am trying to put xticks in a plt figure. However, ticks start from 0 while I want to start from 1 how can I fix this? I tried this (based on a similar question I found) but still nothing. import numpy as np import matplotlib.pyplot as plt y=…
teratoulis
  • 57
  • 5
1
vote
0 answers

Matplotlib: 2 sets of xticks labelling obtained: a character type one (wanted) and a numerical one (unwanted)

I'm trying to left align the y ticks on a barh plot following the ad hoc matplotlib documentaion. However, I get 2 sets of xticks labelling: a character type one (wanted) and a numerical one (unwanted). How can I remove the numerical ticks? Here is…
ecjb
  • 5,169
  • 12
  • 43
  • 79
1
vote
1 answer

Show dates in xticks only where value exist in plot chart of multiple dataframes

I have got a matplotlib question about xticks. I wanted to hide all those values that do not occur. I actually did it, but for the second set of values (red chart). I found how to hide for a specific data frame but not for 2 or more. This is my…
Ignacio Such
  • 129
  • 1
  • 8
1
vote
1 answer

How to add hourly ticks in an axis from datetime formatted data

I have a dataframe of daily temperature variation with time time temp temp_mean 00:01:51.57 185.94 185.94 00:01:52.54 187.48 186.71 00:01:53.51 197.85 190.4233333 00:01:54.49 195.71 191.745 00:01:55.46 197.22 192.84 00:01:56.43 187.33 …
vgb_backup
  • 49
  • 1
  • 6
1
vote
1 answer

How to label only certain x-ticks matplotlib?

In this diagram I have distributed the ticks and applied a tick: ax.set_xticks(np.arange(0, 800, 1)) ax.grid() How can I label on the x-axis only the numbers present in the legend? Regards, Karl
Karl
  • 59
  • 7
1
vote
1 answer

Why doesn't the second x-axis tick label rotate?

I am trying to draw a simple chart with matplotlib. I've got numbers on the vertical axis, and dates on the horizontal axis. For some reason I can't figure out, the 2nd x-axis tick label refuses to rotate. The remaining tick labels are rotated just…
1
vote
1 answer

How to control tic marks and their values in gnuplot tics

My plot has logx axis. So I want to show the tic marks. But due to the size of the tic values they overlap. For example: But if I reduce the tic marks by the command set xtics (1.0e-7,1.0e-5, 5.0e-4); It becomes like I want those logarithmic…
Sahil
  • 256
  • 1
  • 7
1
vote
1 answer

Seaborn lineplot unexpected behaviour in the range of xticks

I am starting my studies on pandas and seaborn. I'm testing the lineplot, but the plot's x-axis does not show the range I expected for this attribute (num_of_elements). I expected that each value of this attribute shows up on the x-axis. Can someone…
1
vote
1 answer

How do i make xticks in a bar graph not be cramped when working with yearly data

I´m getting an issue when trying to do this graph bar and keep getting the same error import matplotlib.pyplot as plt import pandas as pd import numpy as np from datetime import datetime !pip install wbdata import…
Abril
  • 11
  • 2
1
vote
1 answer

Plotting a Time Schedule with Business Hour

I'm implementing a time schedule associated with business hour (8am to 5pm) using pd.offsets.CustomBusinessHour and attempting to plot the gantt chart or horizonal bar chart using matplotlib. At this point, I want to cut off the interval between…
1
vote
1 answer

Shift all time ticks by some amount in Matplotlib?

I am displaying time (hour, minute) ticks on the x-axis in Matplotlib with plt.gca().xaxis.set_major_formatter(matplotlib.dates.DateFormatter("%H:%M")) However, what is happening is that my ticks are not "nice" numbers. The automatic locating of…
blackhole
  • 13
  • 2
1
vote
1 answer

JSXGraph: Is it possible to manually set the x and y tick distance

Say one draws an axis inside a given bounding box, and the ticks are automatically placed. How about placing more/fewer/different ticks along the axes? Is it possible to change the distance of x and y ticks? EDIT: I managed to control minorTicks,…
FlorianL
  • 267
  • 2
  • 10