From dedb30bb13db258f60747bc909d3986dab68efc7 Mon Sep 17 00:00:00 2001
From: lrberge Exporting a graph is often a chore, especially if you want to have
the best looking graphs in your publications. One common problem is that
it is usually difficult to predict how the text contained in the graph
@@ -105,13 +105,12 @@ You can export any kind of graph with the functions
- But first things first, you need to provide the size the image will
take in your final document. By default, the target location of the graph is a US letter
@@ -124,15 +123,17 @@ Now let’s go for the first export: You can notice that in the end of the export, You can notice that in the end of the export,
+ What about the geometry of the graph? By default the width of the
plot is 100% of the text width. You can change it with the
If you increase the pt size that’s what you would get: Now any text is larger, and since there is text in the margins, the
-plotting region becomes smaller. With this way of exporting, you need to worry only on two things: 1)
-the final text size of the graph (and you should be worried about it
-anyway) that you can provide explicitly, and 2) the width to height
-ratio of the graph. As we can see, with a larger font any text is larger, and since there
+is text in the margins, the plotting region becomes smaller. With this way of exporting, you need to worry only on two things: To create the same graph as before but which would take the total
height of the page, just use the argument 07/05/2020
-Exporting graphs with
+fplot
-Exporting graphs with
fplot
+Exporting graphs with
fplot
In essence, it’s a reparametrization of existing export functions.
Below a simple example is detailed.
Example
-
+Example
+
pdf_fit
, png_fit
, etc, which are the
-fplot
versions of pdf
, png
,
-etc.export_graph_start()
and
+export_graph_end()
.
Example
setFplot_page(page = "a4", margins = 1)
-
pdf_fit("first_export.pdf")
+
export_graph_start("first_export.pdf")
plot(1, 1, type = "n", ann = FALSE)
text(1, 1, "This text will be displayed in 10pt.")
-fit.off()
fit.off
is
-used in lieu of dev.off
. This function does the same thing
-as dev.off
but also displays the exported graph in the
-Viewer pane of RStudio (provided you use it). This way you can directly
-see how the exported graph looks.export_graph_end
is used in lieu of dev.off
+(which must be familier to the ones used to export with base R tools).
+This function does the same thing as dev.off
but also
+displays the exported graph in the Viewer pane of RStudio or VSCode
+(provided you use it). This way you can directly see how the exported
+graph looks.width
argument: e.g. using relative widths
@@ -150,28 +151,31 @@ Example
-
pdf_fit("second_export.pdf", pt = 12)
+
export_graph_start("second_export.pdf", pt = 12)
plot(1, 1, type = "n", ann = FALSE)
text(1, 1, "This text will be displayed in 12pt.")
-fit.off()
+
height = 1
-(height = 100%
or height = 1th
[th: text
-height] would also work):height = 100%
or height = 1th
, th
+meaning text height would also
+work):
-pdf_fit("third_export.pdf", pt = 12, height = 1)
+export_graph_start("third_export.pdf", pt = 12, height = 1)
plot(1, 1, type = "n", ann = FALSE)
text(1, 1, "This text will be displayed in 12pt.")
-fit.off()
# You can also set the point size globally
setFplot_page(pt = 12)
-pdf_fit("fourth_export.pdf", sideways = TRUE)
+export_graph_start("fourth_export.pdf", sideways = TRUE)
plot(1, 1, type = "n", ann = FALSE)
text(1, 1, "This text will be displayed in 12pt.")
-fit.off()
export_graph_start
and
+export_graph_end
replace the family of functions
+*_fit
and fit.off()
.fplot_walkthrough.Rmd
Berge L (2023). fplot: Automatic Distribution Graphs Using Formulas. -R package version 1.0.1. +R package version 1.1.0.
@Manual{, title = {fplot: Automatic Distribution Graphs Using Formulas}, author = {Laurent Berge}, year = {2023}, - note = {R package version 1.0.1}, + note = {R package version 1.1.0}, }diff --git a/docs/index.html b/docs/index.html index c3826ac..260c42d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -12,7 +12,7 @@ - +
To be used in combination with pdf_fit
or png_fit
-when exporting images. It performs exactly the same thing as dev.off()
but additionaly
-shows the resulting graph in the viewer pane provided you're using RStudio.
This function is deprecated: Please use the functions export_graph_start()
+and export_graph_end()
instead.
fit.off()
This function does not return anything in R. It closes the connection between the +R graphics engine and a file that has been defined via one of the functions: +pdf_fitpng_fit
+To view the results of PDF exports, the function pdf_convert
from package pdftools
-is used to convert the PDF files into images -- so you need to have installed pdftools
to make it work.
To be used in combination with pdf_fit
or png_fit
+when exporting images. It performs exactly the same thing as dev.off()
but additionaly
+shows the resulting graph in the viewer pane provided you're using RStudio.
To view the results of PDF exports, the function pdf_convert
from package pdftools
+is used to convert the PDF files into images -- so you need to have installed
+pdftools
to make it work.
In PDFs, only the first page will be viewed.
This function is an alternative to pdf
, it makes it easy
+
(This function is deprecated: Please use the functions export_graph_start()
+and export_graph_end()
instead.)
+This function is an alternative to pdf
, it makes it easy
to export figures of appropriate size that should end up in a document. Instead
of providing the height and width of the figure, you provide the fraction of the
text-width the figure should take, and the target font-size at which the plotting
@@ -137,6 +141,13 @@
Other arguments to be passed to pdf
.
This function does not return anything. It connects the output of the R graphics +engine to a file.
+If you use fit.off
instead of dev.off
to close the graph,
diff --git a/docs/reference/plot_box-5.png b/docs/reference/plot_box-5.png
index 76890a5f2ef33f3819675ee0ef047cb968490cd7..37ed72f6d3a2024facad9ec1c2df09a4bbc17a61 100644
GIT binary patch
literal 30923
zcmeFZX;c$g_cvNJwrC^JYAYg>Lx4sQ5Cmk_cEDm(5D}3<8I>V2&x2w^s|Z>N^Q0mm
z^GuinqF|U2LVy4f2q1wF2!sG3I$@8ZPqB_S^Cj3k
zXfFn|e5#Sg$tmx?s98gWp2a1A*BX{w(hwariL~n#+PHXV#}Z0I$s1HyLc)mA_tg_g
zP-w_sde+t3R^!3T920N<&VLe(iy4Ke9S{n^Yy<^BUDE57PSDJmK1SE@nhna)2P#Hs
ztKr)2QVED4eJ75%@{WO@hdkdtMo;`em>pUxVV#W1#^qFEElEjfl#?!-(G`cUI}FL!~+
zE%2#u^y@u}fYLwLAng-4VQ<0}TAl3derX?Dr-qEYpg5*Qjg74p=Sk=GD{$D
exE37w(3L1Lu4x>`6C>fX6`@ebyXRKjF&
z&9dNRUk)1i(_BaYR1IX&`mC9jh#-4N#jHg4QAp6@?lwZG&j!`tA)Gt(qp6v(`7yW+
zRta{UR|gx}%xA;wLR3-O2R2yDBFNN*r8avS(k(#~&^r*qmY%){Ul_?#c^*fS)<8rh
zVaNPF&0tNvjSfFCnwmp!Qptyn`TpVvjPWQ-QYY*68ZNUGidmBWqjn9AZ9J6%u1DjH
z;OwO`9a5U7Ju9n0etlV@GMGW3#l^;og?&D#zZ3qg&fHXo@%HM=qwKY>U%$Q>7#K*a
zawALzh7@FScIL5LWo?2X4B$(iO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