Open newtonharry opened 1 month ago
Thanks for using Marsilea!
I forgot to implement the API that allows the user to retrieve the main ax after combining the plots. This API will be available in the next release. Sorry for the confusion! Ideally, you will have something like:
comb.get_main_ax('track') # For track
comb.get_main_ax('heatmap') # For heatmap
For your use case, I would suggest something like below. Because the xticks is controlled by the plotter, otherwise you need to either implement your RenderPlan
(see how: https://marsilea.readthedocs.io/en/stable/tutorial/new_renderplan.html) or you can add an empty canvas with .add_canvas()
import numpy as np
import marsilea as ma
import marsilea.plotter as mp
data = np.random.randint(0, 10, 1000)
mat = np.random.randn(10, 1000)
start = 58572000
end = 58573000
track = ma.ZeroHeight(10, name="track")
track.add_bottom(mp.Area(data, label="Read Count"), name="peak")
track.add_bottom(mp.Labels(
["" if i % 100 else "-" for i in np.arange(start, end)],
))
track.add_bottom(mp.Labels(
["" if i % 100 else i for i in np.arange(start, end)],
rotation=0,
fontsize=6,
label="Genome Position",
label_loc="right",
))
heatmap = ma.Heatmap(mat, height=1, name="heat")
comb = track / heatmap
comb.render()
Hi,
I have this code which is attempting to plot three different figures. The first is a track plot, and the second two are heatmaps. How do I get access to the second and third
ax
in order to add an x-axis to them?Thanks!