Ask Your Question

Colorbar for density plots

asked 2012-10-23 20:57:25 +0200

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 23:20:24 +0200

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 23:27:55 +0200 )edit

I will try.

Shashank gravatar imageShashank ( 2012-10-24 00:33:01 +0200 )edit

answered 2012-10-23 23:27:09 +0200

kcrisman gravatar image

updated 2012-10-23 23:27:21 +0200

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 20:57:25 +0200

Seen: 676 times

Last updated: Oct 23 '12