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 #139

Draft
wants to merge 73 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
e5a6803
Test to check for title of 3 plots
siddhesh195 Jul 10, 2024
d11bd6f
added test to verify number of tables , their dimensions and number o…
siddhesh195 Jul 12, 2024
ae7bd35
ramping up on animint.js
siddhesh195 Jul 16, 2024
e516b9a
add all plots in single row
siddhesh195 Jul 16, 2024
6ba7e6a
used element variable
siddhesh195 Jul 16, 2024
89c1e2f
Update .gitignore
siddhesh195 Jul 18, 2024
e53e7d9
put all plots in one column
siddhesh195 Jul 22, 2024
0ae75de
add 2 plots per row and then make a new row
siddhesh195 Jul 22, 2024
adf012b
table with 3 plots per row or user defined layout
siddhesh195 Jul 26, 2024
a2b8c0a
test for putting plots in specific location of outer table
siddhesh195 Jul 26, 2024
45bbcf7
check if svg element exists in a particular location of outer table
siddhesh195 Jul 28, 2024
4951b0b
error message if user forgets to add either row or column
siddhesh195 Jul 28, 2024
96c5a45
made function to check svg
siddhesh195 Jul 29, 2024
0a78f92
put plots with fixed locations first, then put all other plots
siddhesh195 Jul 29, 2024
a692b3d
changed scope of implicitly global variables
siddhesh195 Jul 30, 2024
95cd30f
Give error message if only row or col is added in theme
siddhesh195 Jul 30, 2024
6999ac7
theme_animint now accepts dimensions and not theme
siddhesh195 Jul 31, 2024
91d0abb
removed debugging line
siddhesh195 Aug 6, 2024
5b05e8a
removed comments
siddhesh195 Aug 6, 2024
2e1a5f5
reverted to original style and indentation
siddhesh195 Aug 7, 2024
9af1fe8
made border transparent
siddhesh195 Aug 10, 2024
a1735d2
added var as prefix to make it local
siddhesh195 Aug 10, 2024
8698e18
plots save span
siddhesh195 Sep 2, 2024
fbd9541
Merge branch 'master' into html-plot
siddhesh195 Sep 4, 2024
d4c90aa
rowspan is applied
siddhesh195 Sep 4, 2024
80943e6
colspan can now be applied
siddhesh195 Sep 5, 2024
4ac2937
refactoring
siddhesh195 Sep 7, 2024
4a4d8ea
corrected response.plots[p_name].row toresponse.plots[p_name].positio…
siddhesh195 Sep 24, 2024
7fa9efe
throw error if user is incosistent is passing row and col
siddhesh195 Sep 24, 2024
3499fea
removed check_svg function
siddhesh195 Sep 24, 2024
905feb3
refactoring
siddhesh195 Sep 25, 2024
0287024
corrected code to properly traverse the outer table
siddhesh195 Sep 25, 2024
00040cc
Merge branch 'master' into html-plot
siddhesh195 Sep 26, 2024
e46f73c
Test to check for title of 3 plots
siddhesh195 Jul 10, 2024
3cefb99
added test to verify number of tables , their dimensions and number o…
siddhesh195 Jul 12, 2024
efcd2c5
ramping up on animint.js
siddhesh195 Jul 16, 2024
071eeb5
add all plots in single row
siddhesh195 Jul 16, 2024
744a638
used element variable
siddhesh195 Jul 16, 2024
0fe67a8
Update .gitignore
siddhesh195 Jul 18, 2024
57d530b
put all plots in one column
siddhesh195 Jul 22, 2024
c1fbe30
add 2 plots per row and then make a new row
siddhesh195 Jul 22, 2024
8da6e6c
table with 3 plots per row or user defined layout
siddhesh195 Jul 26, 2024
dbbfcc7
test for putting plots in specific location of outer table
siddhesh195 Jul 26, 2024
e671218
check if svg element exists in a particular location of outer table
siddhesh195 Jul 28, 2024
42eaf91
error message if user forgets to add either row or column
siddhesh195 Jul 28, 2024
3a3141b
made function to check svg
siddhesh195 Jul 29, 2024
cb45b68
put plots with fixed locations first, then put all other plots
siddhesh195 Jul 29, 2024
06d5c10
changed scope of implicitly global variables
siddhesh195 Jul 30, 2024
0368b85
Give error message if only row or col is added in theme
siddhesh195 Jul 30, 2024
28f5cac
theme_animint now accepts dimensions and not theme
siddhesh195 Jul 31, 2024
c5e4c8c
removed debugging line
siddhesh195 Aug 6, 2024
aa07dd9
removed comments
siddhesh195 Aug 6, 2024
7b31296
reverted to original style and indentation
siddhesh195 Aug 7, 2024
70d550d
made border transparent
siddhesh195 Aug 10, 2024
d3e15b3
added var as prefix to make it local
siddhesh195 Aug 10, 2024
731041f
plots save span
siddhesh195 Sep 2, 2024
06d02c8
rowspan is applied
siddhesh195 Sep 4, 2024
1eff5de
colspan can now be applied
siddhesh195 Sep 5, 2024
0ecc99f
refactoring
siddhesh195 Sep 7, 2024
54fcb77
corrected response.plots[p_name].row toresponse.plots[p_name].positio…
siddhesh195 Sep 24, 2024
3a11c39
throw error if user is incosistent is passing row and col
siddhesh195 Sep 24, 2024
a21e13b
removed check_svg function
siddhesh195 Sep 24, 2024
841c4ff
refactoring
siddhesh195 Sep 25, 2024
87ecfda
corrected code to properly traverse the outer table
siddhesh195 Sep 25, 2024
47544aa
Merge branch 'html-plot' of https://github.com/animint/animint2 into …
siddhesh195 Sep 26, 2024
c66cdb0
removed blank lines
siddhesh195 Sep 27, 2024
d9e0310
combined getRowAndColumn and getRowspanAndColumnspan functions
siddhesh195 Sep 30, 2024
446e549
reverting changes for debugging
siddhesh195 Oct 1, 2024
ff96811
merged functions into attribute function
siddhesh195 Oct 1, 2024
9624583
code for handling rowspan
siddhesh195 Oct 2, 2024
3996202
removed unnecessary lines and added test
siddhesh195 Oct 3, 2024
700f1d9
refactored code, added test
siddhesh195 Oct 5, 2024
4580713
Merge branch 'master' into html-plot
siddhesh195 Oct 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions tests/testthat/test-renderer3-threeplots.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@


test_that("check if two plots exist", {
data1 <- data.frame(
x = c(1, 2, 3), # x-coordinates of the dots
y = c(1, 4, 9) # y-coordinates of the dots
)

plot1 <- ggplot(data1, aes(x, y)) +
geom_point(size = 2) + # Plot points with a specified size
ggtitle("Plot of 3 Dots") + # Add a title to the plot
xlab("X Axis") + ylab("Y Axis")

data2 <- data.frame(
x = c(1, 2), # x-coordinates of the dots
y = c(1, 4) # y-coordinates of the dots
)

plot2 <- ggplot(data2, aes(x, y)) +
geom_point(size = 2) + # Plot points with a specified size
ggtitle("Plot of 2 Dots") + # Add a title to the plot
xlab("X Axis") + ylab("Y Axis")

data3 <- data.frame(
x = c(2), # x-coordinates of the dots
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change c(2) to 2

y = c(2) # y-coordinates of the dots
)

plot3 <- ggplot(data3, aes(x, y)) +
geom_point(size = 2) + # Plot points with a specified size
ggtitle("Plot of 1 Dot") + # Add a title to the plot
xlab("X Axis") + ylab("Y Axis")

plot_list <- list(
plot1 = plot1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please avoid numbers in variable names (plot1 plot2 plot3)
please use informative names instead of numbers
the names should be human-readable, and help us understand what is the difference between them
also below you do titles[[1]] but titles[["name"]] would be preferable (again, names are easier to understand than numbers)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for example plot names in the layout test could be
left, upper_right, lower_right
etc

plot2=plot2,
plot3=plot3
)

info <-animint2HTML(plot_list)
titles <- getNodeSet(info$html, "//text[@class='plottitle']")
expect_match(xmlValue(titles[[1]]), "Plot of 3 Dots")
expect_match(xmlValue(titles[[2]]), "Plot of 2 Dots")
expect_match(xmlValue(titles[[3]]), "Plot of 1 Dot")
})
Loading