Last active
November 16, 2017 21:16
-
-
Save scottpham/ef55f54c67ac20c98fe812c85fd1155b to your computer and use it in GitHub Desktop.
altair configuration to make pretty charts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure to get all of the methods: | |
from altair import * | |
# set up some color vars: | |
rv_orange="#f38c21" | |
rv_red="#D24435" | |
rv_blue="#0099FF" | |
rv_green="#00B37C" | |
rv_orange_dark="#AA5C09" | |
rv_red_dark="#7D251C" | |
rv_blue_dark="#004D80" | |
rv_green_dark="#004D36" | |
rv_black="#222222" | |
rv_dark_gray="#444444" | |
rv_medium_gray="#666666" | |
rv_light_gray="#888888" | |
Chart(chartData).mark_bar(color=rv_blue_dark).encode( | |
x=X('COLUMN_FOR_X_VALUES:Q', # q means "quantitative" | |
title="TITLE OF X AXIS",), | |
y=Y('COLUMN_FOR_Y_VALUES:O', # o means "object", or string | |
title=" ", # blank out the title name for the y axis if it's obvious | |
sort=SortField(field="X_COLUMN", order="descending", op='max')) | |
).configure( | |
axis=AxisConfig(tickLabelFontSize=14, | |
titleFontSize=19, | |
titleFont="serif", | |
titleFontWeight="400", | |
titleColor=rv_medium_gray, | |
tickColor=rv_light_gray, | |
tickLabelColor=rv_light_gray, | |
axisColor=rv_light_gray, | |
axisWidth=1, | |
gridColor=rv_light_gray, | |
tickLabelFont='Lato'), | |
scale=ScaleConfig(bandSize=25), | |
).configure_cell(width=450, height=400 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment