-
Hi all, In the below example, from plotnine
# tmp_data is data from somewhere else
Nb_list = [ 1, 5, 10, 50]
tmp_data = allstuff.loc[allstuff.query("Ns <= 100 and Nb <= 100 and Nb in @Nb_list").groupby(["Ns", "Nb", "backbone", "sides"]).chiNs.idxmin()]
base = ( ggplot(
data=tmp_data,
mapping= aes(x="Ns", y="chiNs_corrected", color="factor(Nb)"),)
+ geom_point()
+ geom_line()
+ facet_grid("sides ~ backbone", labeller="label_both") \
+ theme(figure_size=(5, 4))
)
print(base)
print(base + aes(y="f_core"))
print(base + aes(y="x") + tmp_data.query("backbone == 'excluded'")) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Create a base plot without data and hide the geoms in a function that takes data and returns a list of layers that plot that data. def layers(data):
return [geom_point(data), geom_line(data)]
base = ( ggplot(
mapping= aes(x="Ns", y="chiNs_corrected", color="factor(Nb)"),)
+ facet_grid("sides ~ backbone", labeller="label_both") \
+ theme(figure_size=(5, 4))
)
base + layers(data)
base + aes(y='d') + layers(data)
base + aes(y='e') + layers(data.query('a > b')) |
Beta Was this translation helpful? Give feedback.
Create a base plot without data and hide the geoms in a function that takes data and returns a list of layers that plot that data.