Skip to content

Instantly share code, notes, and snippets.

@moyocoyani
Created December 6, 2020 18:13
Show Gist options
  • Save moyocoyani/aeeda566cd5bb468099b9b59c230d194 to your computer and use it in GitHub Desktop.
Save moyocoyani/aeeda566cd5bb468099b9b59c230d194 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
#Data to plot
x=np.linspace(1,12,12)
y=[341,657,424,363,123,544,176,566,737,861,651,719]
palette={"primary":"#FEF702",
"background": "#252525",
"primary_chart":"#F1F1F1",
"text_color": "#7F7F7F"}
#Grid and axis---------------------------------------------
#Remove all axis
mpl.rcParams["axes.spines.bottom"] = True
mpl.rcParams["axes.spines.left"] = False
mpl.rcParams["axes.spines.right"] = False
mpl.rcParams["axes.spines.top"] = False
#color and format for axis labels and tick
mpl.rcParams['xtick.color']= '#7F7F7F'
mpl.rcParams['ytick.color']= '#7F7F7F'
mpl.rcParams['xtick.bottom'] = False
mpl.rcParams['ytick.left'] = False
#Grid format
mpl.rcParams["axes.grid"] = True
mpl.rcParams['grid.linestyle'] = '--'
mpl.rcParams['grid.linewidth'] = 1
mpl.rcParams["axes.grid.axis"] = 'y'
mpl.rcParams["grid.color"] = "#404040"
#Text elements---------------------------------------------
#Title format
mpl.rcParams["figure.titlesize"] = 22
mpl.rcParams["figure.titleweight"] = "regular"
#Subtitle format
mpl.rcParams["axes.titlesize"] = 18
mpl.rcParams["axes.titlelocation"]="left"
mpl.rcParams['axes.titleweight'] = "regular"
mpl.rcParams['axes.titlecolor']= '#7F7F7F'
mpl.rcParams['axes.titlelocation']= 'left'
#Other text elements
mpl.rcParams['font.weight'] = "medium"
mpl.rcParams['font.size'] = 14
mpl.rcParams['text.color'] = "#7F7F7F"
#Color for charts elements---------------------------------
#Background color
mpl.rcParams["figure.facecolor"] = palette["background"]
mpl.rcParams["axes.facecolor"] = palette["background"]
mpl.rcParams["savefig.facecolor"] = palette["background"]
mpl.rcParams['axes.labelcolor']= palette["text_color"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment