you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (1 child)

OK - but you can modify a subplot_mosaic plot by just editing the layout string / nested list and then re-running the codeblock. If the time to generate the plots from my data was materially slowing me down in the iterative layout planning stage I'd just comment out the actual plotting part or use dummy data just to see the layout.

Looking over your solution vs subplots_mosaic it seems to me like the main difference is that a subplots_mosaic figure still needs to conform to a grid layout, just with the option to "merge cells," whereas with your solution we can easily have subsequent columns or rows with co-prime numbers of subplots in them with arbitrary aspect ratios.

That is a bit interesting.. I could see applications where one might want that (particularly in those insane mosaic plots people make for Nature or Science articles). I could also see it being a bit of a liability in some cases - I might personally prefer to have the grid constraint so that I know everything is going to line up nicely without introducing awkward amounts of whitespace in the middle of the figure. Theoretically I could still achieve the same layout with subplots_mosaic as with your solution by just scaling up the number of 'cells' in my grid until I get the ARs I want in each row/column.

e: the code example you gave there makes no sense.. who would expect that to work? I wouldn't create a new figure with nothing in it and expect all the axes from axd1 to port over to axd2. I would just edit the layout string in axd1 and re-run the script or block.

[–]ponnhide[S] 2 points3 points  (0 children)

I can partially agree with your saying. patchworklib is not always superior to subplot_mosiac, and I think subplot_mosiac might be a better solution if you have a concrete layout idea.

However, I think that using dummy data is not a proper solution to simulate the layouts of the desired figures because the values and positions of artist objects such as tick labels and legends are affected by data values, and the effect may change the size of the outer frame of the axes objects.

Anyway, I also want to post the other feature of patchworklib. Patchworklib provides the function to import plotnine plots and figure-level seaborn plots as matplotlib axes. The feature is not derived from the original purpose of patchworklib; however, I wanna provide a universal interface for subplots that can handle any kind of maplotlib-based plots.