xticks

How to format the timeseries axis of a matplotlib plot like a pandas plot

How to format the timeseries axis of a matplotlib plot like a pandas plot Question: I’ve created following graph with pd.Series([1]*month_limits.size, month_limits).plot(ax=ax) How do I recreate same x ticks labels with just matplotlib? I mean years and month not overriding each other Best I got is having years and months at the same time, but …

Total answers: 1

How to use xticks and marker functions for smooth line graph – matplotlib

How to use xticks and marker functions for smooth line graph – matplotlib Question: I make a line graph more smooth by applying the following lines of code (based on this post): import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import make_interp_spline #create random data years = list(range(1998, 2021, 1)) print(len(years)) #23 random_values …

Total answers: 1

matplotlib difficult to show all x tick labels

matplotlib difficult to show all x tick labels Question: I have a data series hour 0 35845 1 18921 2 14484 3 12504 4 13862 5 14958 6 23328 7 33580 8 66878 9 65291 10 61785 11 64781 12 68799 13 72486 14 83230 15 75487 16 88231 17 85383 18 75525 19 61739 …

Total answers: 2

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

How to change xticks of bar chart according to values of first dataframe column? Question: 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’: [0,0,0,0,0,0,0,0,0,1,0,0,2,0,0], ‘ACM’: [0,0,0,0,1,1,3,3,0,4,2,5,0,0,0] } df = pd.DataFrame(data) I …

Total answers: 1

Modify major and minor xticks for dates

Modify major and minor xticks for dates Question: I am plotting two pandas series. The index is a date (1-1 to 12-31) s1.plot() s2.plot() pd.plot() interprets the dates and assigns them to axis values as such: I would like to modify the major ticks to be the 1st of every month and minor ticks to …

Total answers: 2

Matplotlib – Changing the color of a single x-axis tick label

Matplotlib – Changing the color of a single x-axis tick label Question: I am trying to create a vertical bar chart of % speakers of 5 spoken languages in the world, using matplotlib. To better accentuate the highest spoken language, I have changed the color of the bar. I also want to change the corresponding …

Total answers: 3

Position of bar plot xtick labels have irregular spaces

Position of bar plot xtick labels have irregular spaces Question: I’m trying to do a bar plot for many countries and i want the names displayed a bit rotated underneath the bars. The problem is that the spaces between the labels are irregular. Here’s the relevant code: plt.bar(i, bar_height, align=’center’, label=country ,color=cm.jet(1.*counter/float( len(play_list)))) xticks_pos = …

Total answers: 1

Changing the "tick frequency" on x or y axis in matplotlib

Changing the tick frequency on the x or y axis Question: I am trying to fix how python plots my data. Say: x = [0, 5, 9, 10, 15] y = [0, 1, 2, 3, 4] matplotlib.pyplot.plot(x, y) matplotlib.pyplot.show() The x axis’ ticks are plotted in intervals of 5. Is there a way to make …

Total answers: 14