Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help supplying discrete RGB colors #4

Open
piazze2 opened this issue Oct 5, 2023 · 0 comments
Open

Help supplying discrete RGB colors #4

piazze2 opened this issue Oct 5, 2023 · 0 comments

Comments

@piazze2
Copy link

piazze2 commented Oct 5, 2023

Hi,

Love the code! It works really well. I'm trying to supply my own list of RGB values:
['#a6ce39','#ccdb99','#739d00','#00708b','#4c9dbb','#00455f','#f2a900','#991e66','#999899','#515250']

This should be similar to your final example, with the exception that your colors were written ("red", "cyan", etc).

Code below, and result attached.

Thanks!

Erin
#Read in dataframe
df = pd.read_csv("Themes.csv")
#Create figure
fig, ax = plt.subplots(figsize=(7,7), dpi=100)
#Create Treemap
trc = tr.treemap(
ax, df, area='# Genes', labels='Theme',cmap=['#a6ce39','#ccdb99','#739d00','#00708b','#4c9dbb','#00455f','#f2a900','#991e66','#999899','#515250'],
rectprops={'ec':'w', 'lw':2},
textprops={'c':'black', 'fontstyle':'normal','reflow':True},
)
#No axis needed
ax.axis('off')
#Save figure
fig.savefig('fig2.svg', dpi='figure', bbox_inches='tight')

fig2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant