| print.unicode_ggplot | R Documentation |
This method temporarily activates the showtext graphics engine to ensure that Unicode characters (e.g., Chinese, special symbols) are rendered correctly when the plot is displayed. After printing, the original graphics device state is restored.
## S3 method for class 'unicode_ggplot'
print(x, ...)
x |
A |
... |
Additional arguments passed to the next print method (e.g., to
|
The method calls showtext::showtext_begin(), then uses
NextMethod() to invoke the original print.ggplot method,
which actually draws the plot. Finally, showtext::showtext_end()
is called to restore the device. This all happens automatically when a
unicode_ggplot object is printed (e.g., when its name is typed at
the console or when print() is explicitly called).
The input object x, returned invisibly.
scatter_plot for creating such objects,
ggsave_unicode for saving them with Unicode support.
## Not run:
p <- scatter_plot(...) # returns a unicode_ggplot object
p # automatically uses this print method
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.