Open gabrielparriaux opened 7 months ago
Did you try to simply use print(rainette_dendrogram)
? Otherwise, it could be better to create a function that generates the plot and return rainette_dendrogram
, then call the function from your quarto document.
Thanks a lot for your answer!
Yes, I tried to just print(rainette_dendrogram)
and the result is the same.
I tried with a function, as you propose.
This is the function I built in my .R external file:
plot_dendrogram <- function() {
rainette_dendrogram <- rainette_plot(
res, dfm, k = 25,
n_terms = 20,
free_scales = FALSE,
measure = "chi2",
show_negative = TRUE,
text_size = 8
)
return(rainette_dendrogram)
}
It’s nearly working, but now, in a chunk of my Quarto document, when I call the function plot_dendrogram()
, it produces both the table and the plot! I’m not sure to understand why…
Is there something I can do to have only the plot and not the table version?
Thanks again for helping!
That's a bit strange indeed. Does it work with invisible(plot_dendrogram())
?
Yes, this way it works with invisible(plot_dendrogram())
correctly!
So I have this function in my external .R file returning the object produced by rainette_plot()
:
plot_dendrogram <- function() {
rainette_dendrogram <- rainette_plot(
res, dfm, k = 25,
n_terms = 20,
free_scales = FALSE,
measure = "chi2",
show_negative = TRUE,
text_size = 8
)
return(rainette_dendrogram)
}
In my main Quarto file, I call the function with invisible()
, so
invisible(plot_dendrogram())
And it displays correctly the plot from rainette and not the table.
Thanks a lot!
Hi,
Using Quarto, I usually have no problem to display the result of my clustering with
rainette_plot()
and to integrate the plot in the html rendering.For code management reasons, I decided to externalise portions of my code in an external .R file.
So I have in the external .R file containing this:
And in my Quarto main document, first I have one chunk to source the .R file: