You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3. Add the subsetted data to another `geom_point` layer
406
408
407
-
# Line plot of unemployment
409
+
## Aligning multiple plots along their shared axis
410
+
411
+
I wanted to add a line plot of employment numbers to the heatmap. Given the similar syntax in plotnine's [compose](https://plotnine.org/guide/plot-composition.html) to R's [patchwork](https://patchwork.data-imaginist.com/), I assumed that alignment of multiple plots would happen automatically. But they don't.
412
+
413
+
414
+
```{python}
415
+
line_plot = (
416
+
ggplot(
417
+
labour_processed_cutted.filter(
418
+
pl.col("YEAR") >= FILTER_YEAR[0],
419
+
pl.col("YEAR") <= FILTER_YEAR[1],
420
+
pl.col("Industry").is_in(["Total employed, all industries"]),
421
+
),
422
+
aes(x="DATE_YMD", y="VALUE"),
423
+
)
424
+
+ geom_line(color = 'black')
425
+
+ theme_tufte()
426
+
+ theme(
427
+
legend_position="none",
428
+
plot_title=element_text(size=10, ha='left'),
429
+
axis_ticks_length=3,
430
+
axis_ticks_major_y=element_line(),
431
+
axis_text_y=element_text(
432
+
size=8, margin={"r": 2, "l": 2, "units": "pt"}),
433
+
)
434
+
+ scale_y_continuous(
435
+
breaks=mb.breaks_extended(3),
436
+
labels=lambda x: ['{:.0f}K'.format(xi / 1000) for xi in x])
0 commit comments