How to display the x-axis label in a stacked bar chart?
Closed this issue · 2 comments
Hi, thanks for using Marsilea.
Most of the time you don't need to touch matplotlib APIs in Marsilea. You always initiate a canvas object in Marsilea and then add things on top of it. This will give you much more flexible controls, you can add the labels on either the bottom or top, and you can easily control the size and padding of all your plotters. Hope you have fun using Marsilea!
import numpy as np
import pandas as pd
import marsilea as ma
import marsilea.plotter as mp
data = np.random.randint(1, 10, (10, 10))
labels = [f"Label_{i+1}" for i in range(10)]
b = ma.WhiteBoard(width=8)
b.add_layer(mp.StackBar(pd.DataFrame(data)))
b.add_bottom(mp.Labels(labels, rotation=0), pad=.1)
b.add_top(mp.Labels(labels, rotation=0), pad=.1)
b.render()
Hi, thanks for using Marsilea.
Most of the time you don't need to touch matplotlib APIs in Marsilea. You always initiate a canvas object in Marsilea and then add things on top of it. This will give you much more flexible controls, you can add the labels on either the bottom or top, and you can easily control the size and padding of all your plotters. Hope you have fun using Marsilea!
import numpy as np import pandas as pd import marsilea as ma import marsilea.plotter as mp data = np.random.randint(1, 10, (10, 10)) labels = [f"Label_{i+1}" for i in range(10)] b = ma.WhiteBoard(width=8) b.add_layer(mp.StackBar(pd.DataFrame(data))) b.add_bottom(mp.Labels(labels, rotation=0), pad=.1) b.add_top(mp.Labels(labels, rotation=0), pad=.1) b.render()
THANK YOU!