How to create a stacked bar chart with gaps between values of each variables in Python
You may apply Wolfram Language to your project. There is a free Wolfram Engine for developers and with the Wolfram Client Library for Python you can use these functions in Python.

from wolframclient.evaluation import WolframLanguageSession
from wolframclient.language import wl, wlexpr


Start the session.

wolfSession = WolframLanguageSession();
A=[3,5,7];
B=[4,5,7];
C=[2,3,4,5,6,7];


Either the ArrayPlot or MatrixPlot functions can be applied. These functions take 2D matrices so first need to convert the lists.

With SparseArray a matrix can be specified without explicitly setting values for all positions. Empty positions are set to '' below.

pos=wolfSession.evaluate(
    wl.Flatten(
        wl.MapIndexed(
            wl.Function(wl.Rule([wl.First(wl.Slot(2)), wl.Slot(1)], wl.First(wl.Slot(2)))),
            [A,B,C],
            [2]
        ),
        1
    )
);
sparse = wolfSession.evaluate(wl.SparseArray(pos, wl.Automatic, ''));

print(wolfSession.evaluate(wl.Normal(sparse)))



[['', '', 1, '', 1, '', 1], 
 ['', '', '', 2, 2, '', 2], 
 ['', 3, 3, 3, 3, 3, 3]]



Using custom ColorRules and FrameTicks to get a basic representation of your plot.  You can use these and many other options to get you precise look you  

stacked=wolfSession.evaluate(
    wl.ArrayPlot(
        sparse,
        AspectRatio = 1/4,
        ColorRules = wl.Flatten(
            [wl.Thread(wl.Rule(wl.Range(3),[wl.Green,wl.Orange,wl.Blue])),
            wl.Rule(wl.Blank(),wl.White)]
        ),
        FrameTicks = [
            [wl.Thread([range(1,4), ['A','B','C']]), wlexpr('None')],
            [
                wl.Thread([ 
                    wl.Range(7), 
                    list(map(lambda r: str(r)+'k', range(1,8)))
                ]), 
                wlexpr('None')
            ]
        ]
    )
);


Then Export in one of the supported Raster Image Formats or Vector Graphics Formats.

wolfSession.evaluate(
    wl.Export(
        '&lt;path with image filename&gt;', 
        stacked
    )
)



  


Terminate session

wolfSession.terminate()


Hope this helps.