-
Notifications
You must be signed in to change notification settings - Fork 29
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
Error in grid.Call.graphics(C_setviewport, vp, TRUE) : non-finite location and/or size for viewport #328
Comments
Hello, I am not sure what is causing that. Can you supply an example of code and data that produces the error? Or is it random (the same data/code sometimes errors and sometimes not)? |
+1 |
Unfortunately, I can't provide the data for this error as it's a client's confidential dataset. However, this error arose when I used a non-standard taxonomy (not a biological taxonomy, but still a taxonomy with 11 taxonomic levels). The input dataset This same taxonomy can be plotted using Thanks for any insight into what might be causing this and how it might be fixed! I suspect the stackoverflow link above is a useful hint as that's what I started looking at, too.
|
Sorry for the trouble, but I am not likely to be able to fix the error without reproducing it, especially since it is happening in ggplot2; the root cause could be in any of the code used to create the data that is plotted, which is a lot of code. Or it could be a rare bug in ggplot2. If anyone can come up with example data/code that results in the error, let me know. Does it always happen for a given data set / code or is it random? |
Hi @zachary-foster I think I have found the source of this error - some of my students have been hitting the same problem. The error occurs when trying to run heat_tree_matrix on data where there are only two levels to be compared. The metacoder script cannot set subgraph_width or subgraph_height if there are less than two comparisons. |
Thanks for the report! I will try it out soon. |
can confirm I just got the same error in the same situation (with two levels) |
Has anyone found a fix or a workaround for this? Thanks!! |
It should be working now. Use This is what happens now: library(metacoder)
#> This is metacoder version 0.3.5.3 (development version)
x <- parse_tax_data(hmp_otus, class_cols = "lineage", class_sep = ";",
class_key = c(tax_rank = "taxon_rank", tax_name = "taxon_name"),
class_regex = "^(.+)__(.+)$")
meta <- hmp_samples[hmp_samples$body_site %in% c('Nose', 'Throat'), ]
# Convert counts to proportions
x$data$otu_table <- calc_obs_props(x, data = "tax_data", cols = meta$sample_id)
#> Calculating proportions from counts for 20 columns for 1000 observations.
# Get per-taxon counts
x$data$tax_table <- calc_taxon_abund(x, data = "otu_table", cols = meta$sample_id)
#> Summing per-taxon counts from 20 columns for 174 taxa
# Calculate difference between treatments
x$data$diff_table <- compare_groups(x, data = "tax_table",
cols = meta$sample_id,
groups = meta$body_site)
# Plot results (might take a few minutes)
heat_tree_matrix(x,
data = "diff_table",
node_size = n_obs,
node_label = taxon_names,
node_color = log2_median_ratio,
node_color_range = diverging_palette(),
node_color_trans = "linear",
node_color_interval = c(-3, 3),
edge_color_interval = c(-3, 3),
node_size_axis_label = "Number of OTUs",
node_color_axis_label = "Log2 ratio median proportions") Created on 2022-12-27 with reprex v2.0.2 |
Great, that works. Thank you! |
@zachary-foster do you know what would cause Also, while a plot is produced, I still get the error message:
Reprex (sorry if it's an annoying one --)
I get these warnings:
here's a preview of
|
Hello,
I have been receiving the following error message while running metacoder:
"Error in grid.Call.graphics(C_setviewport, vp, TRUE) :
non-finite location and/or size for viewport"
The puzzling part with this is that I am producing hundreds of images with metacoder, and only a dozen of analysis is giving that error message. Could this be due to the plotting aspect of metacoder like what is described for ggplot below?
https://stackoverflow.com/questions/55855545/how-can-i-solve-non-finite-location-and-or-size-for-viewport-error
The text was updated successfully, but these errors were encountered: