migration to altair plots
This commit is contained in:
55
theme.py
55
theme.py
@@ -23,3 +23,58 @@ class ColorPalette:
|
||||
TEXT = "black"
|
||||
GRID = "lightgray"
|
||||
BACKGROUND = "white"
|
||||
|
||||
|
||||
def jpmc_altair_theme():
|
||||
"""JPMC brand theme for Altair charts."""
|
||||
return {
|
||||
'config': {
|
||||
'view': {
|
||||
'continuousWidth': 1000,
|
||||
'continuousHeight': 500,
|
||||
'strokeWidth': 0
|
||||
},
|
||||
'background': ColorPalette.BACKGROUND,
|
||||
'axis': {
|
||||
'grid': True,
|
||||
'gridColor': ColorPalette.GRID,
|
||||
'labelFontSize': 11,
|
||||
'titleFontSize': 12,
|
||||
'labelColor': ColorPalette.TEXT,
|
||||
'titleColor': ColorPalette.TEXT,
|
||||
'labelLimit': 200 # Allow longer labels before truncation
|
||||
},
|
||||
'axisX': {
|
||||
'labelAngle': -45,
|
||||
'labelLimit': 200 # Allow longer x-axis labels
|
||||
},
|
||||
'axisY': {
|
||||
'labelAngle': 0
|
||||
},
|
||||
'legend': {
|
||||
'orient': 'top',
|
||||
'direction': 'horizontal',
|
||||
'titleFontSize': 11,
|
||||
'labelFontSize': 11
|
||||
},
|
||||
'title': {
|
||||
'fontSize': 14,
|
||||
'color': ColorPalette.TEXT,
|
||||
'anchor': 'start',
|
||||
'subtitleFontSize': 10,
|
||||
'subtitleColor': 'gray'
|
||||
},
|
||||
'bar': {
|
||||
'color': ColorPalette.PRIMARY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Register Altair theme
|
||||
try:
|
||||
import altair as alt
|
||||
alt.themes.register('jpmc', jpmc_altair_theme)
|
||||
alt.themes.enable('jpmc')
|
||||
except ImportError:
|
||||
pass # Altair not installed
|
||||
|
||||
Reference in New Issue
Block a user