1

I am trying to show number of occurrences of each dog breed as string in x-axis.

enter image description here

I am aware that my string is quite long, which occupied of next tick. Is there any possible way to scale or justified position to have better look?

I did tried to use following code, but it just manage to adjust its column distance. Please note that, the "Source" column referred to a collection of node with string variable.

ax = plt.gca()
dataframe = pd.read_csv('nodes_edges.csv')
x_axis = dataframe['Source'].unique()
ax.tick_params(axis='x', which='major', labelsize = 10)
y_axis = np.array(dataframe['Source'].value_counts())
plt.xlabel('Dog Breed')
plt.ylabel('Number of Occurrence')
plt.rcParams['figure.dpi'] = 200
plt.bar(x_axis, y_axis)
plt.title("Dog Breed Similarity Occurrences")
plt.show()

Appreciate your help, thank you.

Mr. T
  • 11,960
  • 10
  • 32
  • 54
  • 2
    Can you provide a [mcve](https://stackoverflow.com/help/mcve) to the question? – Lucas Sep 03 '18 at 03:26
  • Have you tried to rotate the labels? https://stackoverflow.com/q/10998621/8881141 – Mr. T Sep 03 '18 at 04:00
  • Or you can make [horizontal](https://matplotlib.org/1.2.1/examples/pylab_examples/barh_demo.html) bars as another option – Lucas Sep 03 '18 at 04:19

0 Answers0