Matplotlib, Numpy, mplcyberpunk library python


import matplotlib.pyplot as plt

import numpy as np
import mplcyberpunk

plt.style.use('cyberpunk')

fig,ax=plt.subplots()

bar=ax.bar([1,2,3,4,5,6],[1,2,3,4,5,6])

def gradient(bars):
    grad=np.atleast_2d(np.linspace(1,256))
    ax=bars[0].axes
    lim=ax.get_xlim()+ax.get_ylim()
    for bar in bars:
        #bar.set_zorder(1)
        bar.set_facecolor('none')
        x,y=bar.get_xy()
        w,h=bar.get_width(),bar.get_height()
        ax.imshow(grad,extent=[x,x+w,y,y+h],aspect='auto',zorder=1)
        ax.axis(lim)

gradient(bar)
plt.show()

Comments

Popular Posts