timbod7 / haskell-chart

A 2D charting library for haskell
428 stars 85 forks source link

Subplots alignment #182

Open EvgenyNerush opened 6 years ago

EvgenyNerush commented 6 years ago

Is there a way to align axes size in subplots? Namely, I use the following code gridToRenderable $ above (beside subplotA subplotB) (beside subplotC subplotD) in order to draw this figure: image I would like to have the same size of vertical axes in all plots, and the same size of all horizontal axes. Is it possible to achieve?

EvgenyNerush commented 6 years ago

P.S. Could you, please, comment on my pull request https://github.com/timbod7/haskell-chart/pull/176 . What is wrong with it (it works fine on my machine)?

timbod7 commented 6 years ago

Can you describe what you mean be "align axes sizes" ? Do you want axes to show the same numeric ranges, or just occupy consistent physical space on the page?

EvgenyNerush commented 6 years ago

I meant the same size in pixels ("occupy consistent physical space on the page"). E.g., almost all z-axes in Fig. above have the same numeric ranges, but different sizes. This looks not good.

timbod7 commented 6 years ago

I understand - currently in your example the plot area is what remains after area has been alllocated to axes, legends and titles. If the space taken by these are inconsistent, the the different plot areas will not be the same.

A layout algorithm is required that ensures that all axes are given the same space, titles the same space, etc so the plot areas are consistently sized. Such an algorithm exists for a vertical stack of plots (see https://hackage.haskell.org/package/Chart-1.8.3/docs/Graphics-Rendering-Chart-Layout.html#t:StackedLayouts) but not currently for a grid of plots.

Magalame commented 5 years ago

@EvgenyNerush Hi, would you mind sharing your code to produce your graphs? I'm having trouble resizing mine and you seem to have completely mastered it

EvgenyNerush commented 5 years ago

What code do you mean exactly? The code for the figure above is quite complicated and requires some additional libs. If you mean just some curves in four subplots with some fontsize etc., I can give an example.