Ask Your Question

Colorbar for density plots

asked 2012-10-23 13:57:25 -0500

MelvinSmith gravatar image


I would like to know if there is a way to get a colorbar for a density plot. For contour plots this works fine with the colorbar=True option, but for density plots there doesn't seem to be such an option. Can anyone help?

Greetings, Melvin

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-10-23 16:20:24 -0500

Shashank gravatar image

I don't know the answer in sage but it is easy in matplotlib

import matplotlib
import as cm
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
for i in range(100):
    for j in range(100):
im1 = plt.imshow(array,, origin='lower',clip_on=True,filternorm=1)
edit flag offensive delete link more


Want to take a stab at #9150?

kcrisman gravatar imagekcrisman ( 2012-10-23 16:27:55 -0500 )edit

I will try.

Shashank gravatar imageShashank ( 2012-10-23 17:33:01 -0500 )edit

answered 2012-10-23 16:27:09 -0500

kcrisman gravatar image

updated 2012-10-23 16:27:21 -0500

This isn't built in, though Trac 9150 has been open for this for quite a while, and it probably wouldn't be too hard to put in.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-10-23 13:57:25 -0500

Seen: 235 times

Last updated: Oct 23 '12