Gasp0de
Gasp0de

Reputation: 1429

Matplotlib ignores xlabel

I am creating a plot, and I want to put labels on the axes and a title, but it somehow ignores the plt.xlabel :

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as sp

plt.xlabel = '# blinds'
plt.ylabel = 'time (ms)'
plt.title = 'Encryption Performance'

fig = plt.figure(0)

single_high_error = single_high - datasinglecoremeans
single_low_error = abs(single_low - datasinglecoremeans)
multi_high_error = multi_high - datamulticoremeans
multi_low_error = abs(multi_low - datamulticoremeans)

plt.errorbar(datasinglecore[0], datasinglecoremeans, yerr=np.vstack((single_high_error, single_low_error)), ecolor='skyblue', color='b', label = '1 core')
plt.errorbar(datamulticore[0], datamulticoremeans, yerr=np.vstack((multi_high_error, multi_low_error)), ecolor='orange', color='r', label = '4 cores')
# plt.xscale('log')
# plt.yscale('log')

plt.legend()

fig.savefig("encryption.png")
plt.show()

This is what it looks like:plot Can anyone tell me what I am doing wrong?

Upvotes: 2

Views: 389

Answers (1)

Gambit1614
Gambit1614

Reputation: 8801

It because you are assigning it incorrectly, it should be

plt.xlabel('# blinds')
plt.ylabel('time (ms)')
plt.title('Encryption Performance')

What you are doing is syntactically incorrect. For instance xlabel is a function as mentioned here, and you are trying to assign a value to a function which is wrong, you to have to use it's signature. Same for ylabel abd title.

Upvotes: 1

Related Questions