Home > Net >  Python chart using matplotlib and pandas from csv does not show all x-axis labels
Python chart using matplotlib and pandas from csv does not show all x-axis labels

Time:06-17

pls consider me as newbie in python. I got to chart a data from csv somewhere from my directory. I using python by learning some samples online. Problem is, i cant find any solution to show all x-axis labels...Please help me guys/gals...below us my code...thanks in advance:

import pandas as pd
import matplotlib.pyplot as plt

plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True

pathcsv = r'D:\iPython\csvfile\samplecsv2.csv'
df = pd.read_csv(pathcsv)
df.set_index('Names').plot()

plt.show()

CodePudding user response:

here is the result of graph...but i want all x-labels to show.

enter image description here

CodePudding user response:

[Here is i print the dataframe print(df)][1]

Names Age Marks 0 Japan 34 65 1 Rusia 32 45 2 Malay 22 76 3 Indo 33 66 4 Sing 43 78 5 Phil 23 98 6 Thai 23 76 7 India 22 97 8 USA 44 78 9 Can 22 78 [1]: https://i.stack.imgur.com/Vlm8d.png

  • Related