Skip to content

Instantly share code, notes, and snippets.

@paduel
Created October 27, 2019 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paduel/f8ac6f1627ddaad0634fd661fa858dc9 to your computer and use it in GitHub Desktop.
Save paduel/f8ac6f1627ddaad0634fd661fa858dc9 to your computer and use it in GitHub Desktop.
Generate new Pandas logo with Altair
# script to generate the neww pandas logo
# MrEavesXLModOT-Bold font must be installed
import altair as alt
from pandas import DataFrame
source = DataFrame({
'x': [1, 2, 2, 2, 3, 3, 3, 4],
'y': [0, 54.17, 119.6, 157.8, 13.73, 78.13, 116.17, 54.17],
'y2': [167.0, 105.37, 144.17, 209.0, 64.93, 102.7, 167.37, 221.17],
'c': ['#ffffff',
'#ffffff',
'#ffca00ff',
'#ffffff',
'#ffffff',
'#e70488ff',
'#ffffff',
'#ffffff'],
't': [''] * 7 + ['pandas']})
bars = alt.Chart(source).mark_bar(size=29).encode(
x=alt.X('x:N', scale=alt.Scale(rangeStep=47), axis=None),
y=alt.Y('y', axis=None),
y2='y2',
color=alt.Color('c', scale=None)
)
text = alt.Chart(source).mark_text(
align='left',
baseline='middle',
font='MrEavesXLModOT-Bold',
fontSize=220,
dx=87,
dy=-14,
href='https://pandas.pydata.org/'
).encode(
x=alt.X('x:N', scale=alt.Scale(rangeStep=47), axis=None),
text='t',
color=alt.Color('c', scale=None))
pandas_logo = alt.layer(bars, text,
background='#150458ff',
padding={"left": 456, "top": 148, "right": 441, "bottom": 168},
).configure_view(strokeOpacity=0)
pandas_logo.save('pandas_logo.html')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment