@@ -21,6 +21,7 @@ Related with this, is one very helpful article by Paul Murrell: [The
2121gridGraphics
2222Package] ( https://journal.r-project.org/archive/2015-1/murrell.pdf ) .
2323
24+
2425Status
2526------
2627
@@ -45,182 +46,10 @@ Then, load it:
4546
4647 library(graphicsutils)
4748
48- Main features
49- -------------
50-
51- ### Empty your plot
52-
53- To start a figure from scratch it is often useful to get a plot without
54- nothing but having the correct size of axes. ` plot0() ` allows the user
55- to do so:
56-
57- plot0(c(0,1),c(0,1))
58-
59- ![ ] ( inst/assets/img/plot0-1.png )
60-
61- Quite empty, isn’t it? Also, it can be filled with any color using the
62- ` fill ` parameter.
63-
64- plot0(c(-10,10), fill='#ebebeb', grid.col = 'white')
65-
66- ![ ] ( inst/assets/img/plot0v2-1.png )
67-
68- And also add a text:
69-
70- plot0(c(-10,10), asp=1, fill=8, text='cool', srt=45, cex=4, col=2)
71-
72- ![ ] ( inst/assets/img/plot0v3-1.png )
73-
74- ### Add a box
75-
76- The ` box2() ` function allows the user to add any axes around the plot in
77- a more flexible way.
78-
79- par(mar=rep(2,4))
80- plot0()
81- box2(which="figure", lwd=2, fill="grey30")
82- box2(side=12, lwd=2, fill="grey80")
83- axis(1)
84- axis(2)
85-
86- ![ ] ( inst/assets/img/box2-1.png )
87-
88- ### Encircle points
89-
90- coords <- cbind(runif(10), runif(10))
91- plot0(coords)
92- points(coords, bg="grey25", pch=21)
93- encircle(coords, border="#7b11a1", lwd=2)
94-
95- ![ ] ( inst/assets/img/encircle-1.png )
96-
97- ### Add an image
98-
99- The ` pchImage() ` function eases the uses of ` rasterImage() ` to add
100- images (including png and jpeg files) on a graph. It allows to change
101- the color of the whole image.
102-
103- pathLogo <- system.file("img", "Rlogo.png", package="png")
104- par(mar=c(4,1,4,1), mfrow=c(1,2))
105- plot0()
106- pchImage(0, 0, file=pathLogo, cex.x =4.5, cex.y=4)
107- plot0()
108- pchImage(0, 0, file=pathLogo, cex.x =4.5, cex.y=4, col="grey25", angle=25)
109-
110- ![ ] ( inst/assets/img/pchImage-1.png )
111-
112- ### A stacked areas chart
113-
114- #### A simple stacked areas
115-
116- plot0(c(0, 10),c(0, 10))
117- sz <- 100
118- seqx <- seq(0, 10, length.out=sz)
119- seqy1 <- 0.2*seqx*runif(sz, 0, 1)
120- seqy2 <- 4+0.25*seqx*runif(sz, 0, 1)
121- seqy3 <- 8+0.25*seqx*runif(sz, 0, 1)
122- envelop(seqx, seqy1, seqy2, col="grey85", border=NA)
123-
124- ![ ] ( inst/assets/img/envelop-1.png )
125-
126- #### A complete stacked areas
12749
128- x <- data.frame(matrix(runif(200, 2, 10), 8, 25))
129- stackedAreas(x)
130-
131- ![ ] ( inst/assets/img/stackedArea-1.png )
132-
133- ### Polar plot
134-
135- polarPlot(1:40, stats::runif(40), to=1.9*pi, col="grey30", border="grey80")
136-
137- ![ ] ( inst/assets/img/polarPlot-1.png )
138-
139- ### Get pretty ranges
140-
141- vec <- stats::runif(20)
142- range(vec)
143- R>> [1] 0.05697909 0.95889704
144- prettyRange(vec)
145- R>> [1] 0.05 1.00
146- prettyRange(c(3.85, 3.88245))
147- R>> [1] 3.850 3.885
148-
149- ### Interactive functions
150-
151- Some functions are interactive and fairly understandable! So, I suggest
152- you try the following functions:
153-
154- pickColors()
155-
156- layout2()
157-
158- ### Colors
159-
160- ` darken() ` and ` lighten() ` functions are convenient way to produce
161- consistent set of shaded colors with minimal effort; also use
162- ` showPalette() ` to display your palette.
163-
164- someblue <- darken("blue", 10*1:9)
165- showPalette(someblue)
166-
167- ![ ] ( inst/assets/img/darken-1.png )
168-
169- somered <- lighten("red", 10*1:9)
170- showPalette(somered, add_codecolor=TRUE)
171-
172- ![ ] ( inst/assets/img/lighten-1.png )
173-
174- Since version 1.1-2 a set of color palettes has been added, see
175- ` gpuPalette() ` .
176-
177- showPalette(gpuPalette("insileco"), add_codecolor=TRUE)
178-
179- ![ ] ( inst/assets/img/insileco-1.png )
180-
181- Image 2
182- -------
183-
184- image2(matrix(1:9, 3))
185-
186- ![ ] ( inst/assets/img/image2-1.png )
187-
188- image2(matrix(1:27, 3), from=2, border = 2, lwd=2)
189-
190- ![ ] ( inst/assets/img/image2-2.png )
191-
192- Vector fields
50+ Main features
19351-------------
19452
195- systLin <- function(X, beta){
196- Y <- matrix(0,ncol=2)
197- Y[1L] <- beta[1,1]*X[1L]+beta[1,2]*X[2L]
198- Y[2L] <- beta[2,1]*X[1L]+beta[2,2]*X[2L]
199- return(Y)
200- }
201- seqx <- seq(-2,2,0.31)
202- seqy <- seq(-2,2,0.31)
203- beta1 <- matrix(c(0,-1,1,0),2)
204- # Plot 1:
205- vecfield2d(coords=expand.grid(seqx, seqy), FUN=systLin, args=list(beta=beta1))
206-
207- ![ ] ( inst/assets/img/vectorfields-1.png )
208-
209- # # Plot 2:
210- graphics::par(mar=c(2,2,2,2))
211- vecfield2d(coords=expand.grid(seqx, seqy), FUN=systLin,
212- args=list(beta=beta1), cex.x=0.35, cex.arr=0.25,
213- border=NA,cex.hh=1, cex.shr=0.6, col=8)
214- graphics::abline(v=0, h=0)
215-
216- ![ ] ( inst/assets/img/vectorfields-2.png )
217-
218- Compass Rose
219- ------------
220-
221- compassRose(0, rot=25, cex.cr = 2, col.let =2, add = FALSE)
222-
223- ![ ] ( inst/assets/img/compassRose-1.png )
22453
22554Code of Conduct
22655---------------
0 commit comments