I have a koalas dataframe. I would like to plot a histogram but I would like to change the color with an RGB tuple (r,g,b). How can I alter the code below to do this?
import databricks.koalas as ks
import pandas as pd
import numpy as np
import random
random.seed(12345)
RGB = (172,8,14) # or RGB = (172/255,8/255,14/255)
pdf = pd.DataFrame(np.random.normal(size=(100000,1)), columns = ["x"])
kdf = ks.from_pandas(pdf)
kdf.hist(title='How do I change the color to RGB?', bins=50, legend = False)
I figured it out!
import databricks.koalas as ks
import pandas as pd
import numpy as np
import random
from matplotlib.colors import ListedColormap
random.seed(12345)
RGB = np.array([172/255,8/255,14/255])
pdf = pd.DataFrame(np.random.normal(size=(100000,1)), columns = ["x"])
kdf = ks.from_pandas(pdf)
kdf.hist(title='There! I changed the color!', bins=50, legend = False, colormap= ListedColormap(RGB))