Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout ggplots in a table #115

Open
tdhock opened this issue Dec 19, 2023 · 2 comments
Open

layout ggplots in a table #115

tdhock opened this issue Dec 19, 2023 · 2 comments

Comments

@tdhock
Copy link
Collaborator

tdhock commented Dec 19, 2023

currently ggplots appear one after another in the rendered HTML code, and the visual layout is determined interactively, by resizing/zooming the window. layout here means how to arrange the ggplots in a grid (is plot 3 to the right of plot 2, or below plot 1?)
would be nice if we could implement some simple method for defining the layout.
for example below plots are in a 2x2 table, plot1 is on the first/left column, spanning both rows; plot2 is on the second/right column, first row; plot3 is on the second/right column, second row.

animint(
  plot1=ggplot()+theme_animint(row=1, col=1, rowspan=2)),
  plot2=ggplot()+theme_animint(row=1, col=2),
  plot3=ggplot()+theme_animint(row=2, col=2))
@Tushar98644
Copy link

currently ggplots appear one after another in the rendered HTML code, and the visual layout is determined interactively, by resizing/zooming the window. layout here means how to arrange the ggplots in a grid (is plot 3 to the right of plot 2, or below plot 1?) would be nice if we could implement some simple method for defining the layout. for example below plots are in a 2x2 table, plot1 is on the first/left column, spanning both rows; plot2 is on the second/right column, first row; plot3 is on the second/right column, second row.

animint(
  plot1=ggplot()+theme_animint(row=1, col=1, rowspan=2)),
  plot2=ggplot()+theme_animint(row=1, col=2),
  plot3=ggplot()+theme_animint(row=2, col=2))

I would greatly appreciate it if you could guide me on how the output HTML and JavaScript are presently generated, as well as which specific files I should refer to for this information. I intend to include the resolution to this issue in my proposal.

@tdhock
Copy link
Collaborator Author

tdhock commented Mar 26, 2024

https://github.com/animint/animint2/blob/master/inst/htmljs/animint.js#L148 selects an element in which the plots will be added

https://github.com/animint/animint2/blob/master/inst/htmljs/animint.js#L221 adds a table which will contain a new plot, one after the other, so this is one of the lines that needs to be modified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants