c# free pdf viewer : Add and remove pages from a pdf SDK Library service wpf asp.net windows dnn R%20Graphics%20Cookbook23-part704

Table 9-1. Text properties of theme elements and text geoms
Theme elements s Text geoms
Description
family
family
HelveticaTimesCourier
face
fontface
plainbolditalicbold.italic
colour
colour
Color (name or "#RRGGBB")
size
size
Font size (in points for theme elements; in mm for geoms)
hjust
hjust
Horizontal alignment: 0=left, 0.5=center, 1=right
vjust
vjust
Vertical alignment: 0=bottom, 0.5=middle, 1=top
angle
angle
Angle in degrees
lineheight
lineheight Line spacing multiplier
The theme elements are listed in Table 9-2. Most of them are straightforward. Some are
shown in Figure 9-4.
Table 9-2. Theme items that control text appearance in theme()
Element name
Description
axis.title
Appearance of axis labels on both axes
axis.title.x
Appearance of x-axis label
axis.title.y Appearance of y-axis label
axis.ticks
Appearance of tick labels on both axes
axis.ticks.x Appearance of x tick labels
axis.ticks.y Appearance of y tick labels
legend.title Appearance of legend title
legend.text
Appearance of legend items
plot.title
Appearance of overall plot title
strip.text
Appearance of facet labels in both directions
strip.text.x
Appearance of horizontal facet labels
strip.text.y Appearance of vertical facet labels
9.2. Changing the Appearance of Text | 215
Add and remove pages from a pdf - insert pages into PDF file in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Guide C# Users to Insert (Empty) PDF Page or Pages from a Supported File Format
add page numbers to pdf; add page numbers to pdf document
Add and remove pages from a pdf - VB.NET PDF Page Insert Library: insert pages into PDF file in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Easy to Use VB.NET APIs to Add a New Blank Page to PDF Document
add page pdf reader; add a page to a pdf document
Figure 9-4. Aligning with hjust and vjust, and spacing with lineheight
9.3. Using Themes
Problem
You want to use premade themes to control the overall plot appearance.
Solution
To use a premade theme, add theme_bw() or theme_grey() (Figure 9-5):
library(gcookbook) # For the data set
# Base plot
<- ggplot(heightweight, aes(x=ageYear, y=heightIn)) + geom_point()
# Grey theme (the default)
+ theme_grey()
# Black-and-white theme
+ theme_bw()
Discussion
Some commonly used properties of theme elements in ggplot2 are those things that are
controlled by theme(). Most of these things, like the title, legend, and axes, are outside
the plot area, but some of them are inside the plot area, such as grid lines and the
background coloring.
216 | Chapter 9: Controlling the Overall Appearance of Graphs
VB.NET PDF Password Library: add, remove, edit PDF file password
manipulations. Open password protected PDF. Add password to PDF. Change PDF original password. Remove password from PDF. Set PDF security level. VB
adding page to pdf in preview; adding page numbers in pdf
VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
can simply delete a single page from a PDF document using VB.NET or remove any page Add necessary references: How to VB.NET: Delete Consecutive Pages from PDF.
add page to pdf preview; add pdf pages together
Figure 9-5. Left: scatter plot with theme_grey() (the default); right: with theme_bw()
The two included themes are theme_grey() and theme_bw(), but it is also possible to
create your own.
You can set the base font family and size with either of the included themes (the default
base font family is Helvetica, and the default size is 12):
+ theme_grey(base_size=16, base_family="Times")
You can set the default theme for the current R session with theme_set():
# Set default theme for current session
theme_set(theme_bw())
# This will use theme_bw()
9.3. Using Themes | 217
C# PDF Page Delete Library: remove PDF pages in C#.net, ASP.NET
Ability to remove a range of pages from PDF file. Add necessary references: Demo Code: How to Delete Consecutive Pages from PDF in C#.NET.
add page numbers to a pdf in preview; adding page numbers to pdf document
C# PDF Password Library: add, remove, edit PDF file password in C#
String outputFilePath = Program.RootPath + "\\" Output.pdf"; // Remove the password. doc.Save(outputFilePath); C# Sample Code: Add Password to Plain PDF
add page numbers to pdf preview; add a blank page to a pdf
p
# Reset the default theme back to theme_grey()
theme_set(theme_grey())
See Also
To modify a theme, see Recipe 9.4.
To create your own themes, see Recipe 9.5.
See ?theme to see all the available theme properties.
9.4. Changing the Appearance of Theme Elements
Problem
You want to change the appearance of theme elements.
Solution
To modify a theme, add theme() with a corresponding element_xx object. These include
element_lineelement_rect, and element_text. The following code shows how to
modify many of the commonly used theme properties (Figure 9-6):
library(gcookbook) # For the data set
# Base plot
<- ggplot(heightweight, aes(x=ageYear, y=heightIn, colour=sex)) + geom_point()
# Options for the plotting area
+ theme(
panel.grid.major = element_line(colour="red"),
panel.grid.minor = element_line(colour="red", linetype="dashed", size=0.2),
panel.background = element_rect(fill="lightblue"),
panel.border = element_rect(colour="blue", fill=NA, size=2))
# Options for text items
+ ggtitle("Plot title here"+
theme(
axis.title.x = element_text(colour="red", size=14),
axis.text.x  = element_text(colour="blue"),
axis.title.y = element_text(colour="red", size=14, angle = 90),
axis.text.y  = element_text(colour="blue"),
plot.title = element_text(colour="red", size=20, face="bold"))
# Options for the legend
+ theme(
legend.background = element_rect(fill="grey85", colour="red", size=1),
legend.title = element_text(colour="blue", face="bold", size=14),
218 | Chapter 9: Controlling the Overall Appearance of Graphs
C# PDF Digital Signature Library: add, remove, update PDF digital
Image: Insert Image to PDF. Image: Remove Image from Redact Text Content. Redact Images. Redact Pages. Annotation & Highlight Text. Add Text. Add Text Box. Drawing
add page numbers to a pdf document; add page number to pdf document
C# PDF remove image library: remove, delete images from PDF in C#.
Image: Insert Image to PDF. Image: Remove Image from Redact Text Content. Redact Images. Redact Pages. Annotation & Highlight Text. Add Text. Add Text Box. Drawing
add pdf pages to word document; add page to pdf reader
legend.text = element_text(colour="red"),
legend.key = element_rect(colour="blue", size=0.25))
# Options for facets
+ facet_grid(sex ~ .+ theme(
strip.background = element_rect(fill="pink"),
strip.text.y = element_text(size=14, angle=-90, face="bold"))
# strip.text.x is the same, but for horizontal facets
Figure 9-6. Clockwise from top left: modifying theme properties for the plotting area, the
legend, the facets, and the text items
9.4. Changing the Appearance of Theme Elements | 219
C# PDF bookmark Library: add, remove, update PDF bookmarks in C#.
Help to add or insert bookmark and outline into PDF file in .NET framework. Ability to remove and delete bookmark and outline from PDF document.
adding page numbers to a pdf file; add a page to a pdf
C# PDF metadata Library: add, remove, update PDF metadata in C#.
Add metadata to PDF document in C# .NET framework program. Remove and delete metadata from PDF file. Also a PDF metadata extraction control.
adding page numbers to pdf files; add page number to pdf file
Discussion
If you want to use a saved theme and tweak a few parts of it with theme(), the theme()
must come after the theme specification. Otherwise, anything set by theme() will be
unset by the theme you add:
# theme() has no effect if before adding a complete theme
+ theme(axis.title.x = element_text(colour="red")) + theme_bw()
# theme() works if after a compete theme
+ theme_bw() + theme(axis.title.x = element_text(colour="red", size=12))
Many of the commonly used theme properties are shown in Table 9-3.
Table 9-3. Theme items that control text appearance in theme()
Name
Description
Element type
text
All text elements
element_text()
rect
All rectangular elements
element_rect()
line
All line elements
element_line()
axis.line
Lines along axes
element_line()
axis.title
Appearance of both axis labels
element_text()
axis.title.x
X-axis label appearance
element_text()
axis.title.y
Y-axis label appearance
element_text()
axis.text
Appearance of tick labels on both axes
element_text()
axis.text.x
X-axis tick label appearance
element_text()
axis.text.y
Y-axis tick label appearance
element_text()
legend.background
Background of legend
element_rect()
legend.text
Legend item appearance
element_text()
legend.title
Legend title appearance
element_text()
legend.position
Position of the legend
"left""right""bottom""top", or
two-element numeric vector if you wish to place it
inside the plot area (for more on legend placement,
see Recipe 10.2)
panel.background
Background of plotting area
element_rect()
panel.border
Border around plotting area
element_rect(linetype="dashed")
panel.grid.major
Major grid lines
element_line()
panel.grid.major.x Major grid lines, vertical
element_line()
panel.grid.major.y Major grid lines, horizontal
element_line()
panel.grid.minor
Minor grid lines
element_line()
panel.grid.minor.x Minor grid lines, vertical
element_line()
panel.grid.minor.y Minor grid lines, horizontal
element_line()
220 | Chapter 9: Controlling the Overall Appearance of Graphs
VB.NET PDF remove image library: remove, delete images from PDF in
Image: Insert Image to PDF. Image: Remove Image from Redact Text Content. Redact Images. Redact Pages. Annotation & Highlight Text. Add Text. Add Text Box. Drawing
add page numbers to pdf document in preview; add page numbers to pdf files
VB.NET PDF metadata library: add, remove, update PDF metadata in
Add permanent metadata to PDF document in VB .NET framework program. Remove and delete metadata content from PDF file in Visual Basic .NET application.
adding a page to a pdf in preview; adding pages to a pdf document in preview
Name
Description
Element type
plot.background
Background of the entire plot
element_rect(fill = "white", col
our = NA)
plot.title
Title text appearance
element_text()
strip.background
Background of facet labels
element_rect()
strip.text
Text appearance for vertical and horizontal
facet labels
element_text()
strip.text.x
Text appearance for horizontal facet labels
element_text()
strip.text.y
Text appearance for vertical facet labels
element_text()
9.5. Creating Your Own Themes
Problem
You want to create your own theme.
Solution
You can create your own theme by adding elements to an existing theme (Figure 9-7):
library(gcookbook) # For the data set
# Start with theme_bw() and modify a few things
mytheme <- theme_bw() +
theme(text       = element_text(colour="red"),
axis.title = element_text(size = rel(1.25)))
# Base plot
<- ggplot(heightweight, aes(x=ageYear, y=heightIn)) + geom_point()
# Plot with modified theme
+ mytheme
Discussion
With ggplot2, you can not only make use of the default themes, but also modify these
themes to suit your needs. You can add new theme elements or change the values of
existing ones, and apply your changes globally or to a single plot.
See Also
The options for modifying themes are listed in Recipe 9.4.
9.5. Creating Your Own Themes | 221
Figure 9-7. A modified default theme
9.6. Hiding Grid Lines
Problem
You want to hide the grid lines in a plot.
Solution
The major grid lines (those that align with the tick marks) are controlled with pan
el.grid.major. The minor grid lines (the ones between the major lines) are controlled
with panel.grid.minor. This will hide them both, as shown in Figure 9-8 (left):
library(gcookbook) # For the data set
<- ggplot(heightweight, aes(x=ageYear, y=heightIn)) + geom_point()
+ theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank())
222 | Chapter 9: Controlling the Overall Appearance of Graphs
Figure 9-8. Left: no grid lines; middle: no vertical lines; right: no horizontal lines
Discussion
It’s possible to hide just the vertical or horizontal grid lines, as shown in the middle and
righthand graphs in Figure 9-8, with panel.grid.major.xpanel.grid.major.ypan
el.grid.minor.x, and panel.grid.minor.y:
# Hide the vertical grid lines (which intersect with the x-axis)
+ theme(panel.grid.major.x = element_blank(),
panel.grid.minor.x = element_blank())
# Hide the horizontal grid lines (which intersect with the y-axis)
+ theme(panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank())
9.6. Hiding Grid Lines | 223
Documents you may be interested
Documents you may be interested