Back to the main page.

# Bug 1010 - layout of subplots in ft_topoplotER

Status | CLOSED FIXED |

Reported | 2011-10-04 16:37:00 +0200 |

Modified | 2011-10-05 15:09:09 +0200 |

Product: | FieldTrip |

Component: | core |

Version: | unspecified |

Hardware: | PC |

Operating System: | Linux |

Importance: | P1 enhancement |

Assigned to: | Jan-Mathijs Schoffelen |

URL: | |

Tags: | |

Depends on: | |

Blocks: | |

See also: |

## Gio Piantoni - 2011-10-04 16:37:58 +0200

It's possible and very handy to plot multiple time windows with ft_topoplotER by passing a vector to cfg.xlim I was plotting 6 subplots of ft_topoplotER, but the layout grid is 3x3, which leaves 3 subplots empty. I suggest to change ft_topoplotER at line 451, from subplot(ceil(sqrt(length(xlims)-1)), ceil(sqrt(length(xlims)-1)), i); into nplot = length(xlims)-1; nyplot = ceil(sqrt(nplot)); nxplot = ceil(nplot/nyplot); subplot(nxplot, nyplot, i); In this way, you get fewer empty subplots. Compare the two methods if you were to plot from 1 to 40 subplots: nplots = 1:40; x = ceil(sqrt(nplots)); y = ceil(sqrt(nplots)); emptyplot_sqrt = x.*y - nplots; % number of empty plots using the current method x = ceil(sqrt(nplots)); y = ceil(nplots./x); emptyplot_div = x.*y - nplots; % number of empty plots using the suggested method (always fewer than the current method) Compare the number of empty subplots as function of the number of total subplots [nplots' emptyplot_sqrt' emptyplot_div']

## Jan-Mathijs Schoffelen - 2011-10-05 09:06:24 +0200

Dear Gio, Thanks for this well thought through and clearly demonstrated suggestion. Consider it implemented in the coming 5 minutes. Would you by the way like to have svn-privileges so that you can make such changes yourself in the future?