5

How to change the color of a matplotlib graph? Now the title is black but the other texts are grey. I'm creating a Hexbin graph using Pandas plot. I have already tried

matplotlib.rcParams.update({'text.color': 'black'})

As I understood from http://matplotlib.org/users/customizing.html But it doesn't work.

import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot')
font = {'family' : 'normal',
        'weight' : 'bold',
        'size'   : 22}                          
matplotlib.rc('font', **font)

t = pessoas.plot.hexbin(x='qteViagens',y='qteDestUnicos',cmap=plt.cm.jet,gridsize=20,norm=matplotlib.colors.LogNorm(),colorbar=False)
t.set_xlabel('Number of Trips in Period')
t.set_ylabel('Number of Unique Destinations')
t.set_title('Number of Users')

Matplotlib Hexbin graph

0

1 Answer 1

1

In order to change the color of the axis one might do

axes.xaxis.label.set_color("yellow")

axes.yaxis.label.set_color("green")

enter image description here

Alternatively, one can pass the color of the labels when creating them with matplotlib.axes.Axes.set_xlabel, such as

ax.set_xlabel('Number of Trips in Period', color='yellow') 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.