The following plots take the Weibull distribution (Weber distribution, Weibull distribution) as an exampleFor Weibull distribution (Weber distribution, Weibull distribution), please refer to my blog http://www.cnblogs.com/wwxbi/p/6141501.htmlLibrary (GGPLOT2)# both D and Y here are in order of sizedYDfGgplot (Df,aes (x=d,y)) +Geom_line (colour= "green") +Ggtitle ("Weibull distribution \ n probability density map")# Here's H no size orderH Ggplot (Null
1. color and shape control
Data features can be expressed not only by coordinates, but also by different colors or shapes. Taking the MPG dataset as an example, the variables used include cty (driving distance in the city), hwy (highway driving distance), displ (displacement size), and year (production year)
1 library(ggplot2)2 p
We will use a red circle to represent the models produced in 1999, and a blue triangle to represent the displacement in
After Geom settings and scale settings, to make the picture beautiful, the theme setting is not less thanElement_text () is an important piece of content in the theme settingsElement_text(Family =Null, Face =Null, Colour =Null, size =Null, Hjust =Null, Vjust =Null, Angle =Null, lineheight =Null)Parameter family represents a font styleThe parameter face represents the font format, the desired value ("plain", "italic", "bold", "Bold.italic")Parameter colour indicates font colorParameter size indi
Ggplot2 scale correlation settings-coordinate transformationThere are several forms of axis conversion in R, including logarithmic conversion, square root conversion, and pre-and post-scale exchange of coordinates.The functions used are:SCALE_X_LOG10 (...) SCALE_Y_LOG10 (...) Scale_x_sqrt (...) Scale_y_sqrt (...) Scale_x_reverse (...) Scale_y_reverse (...) The above functions are actually based on scale_x_continuous (name = Waiver (), breaks = Waiver
can choose X or Y, indicate the extension coordinates, start is coordinates start angle, default actually position is 12 o'clock,The direction represents the direction of the data, 1 is clockwise, and 1 is counterclockwise.Let's look at some specific examples:Library (Ggplot2) P The Cartesian coordinate transformation is the same as the normal drawing effect.P+coord_flip () The horizontal and vertical coordinates are interchanged, and a bar chart m
In the process of drawing, sometimes we may need to add some lines, so that the visualization of the graph becomes better, such as some trend lines and so on.Let's take a look at some of the ways the lines are added.Geom_abline (mapping = NULL, data = NULL, ..., slope, intercept, na.rm = FALSE, show.legend = NA) geom_hline (mapping = NULL, data = null, ..., yintercept, na.rm = FALSE, show.legend = NA) geom_vline (mapping = NULL, data = NULL, ..., xintercept, NA . RM = FALSE, show.legend = NA) Th
Introduction
We can also handle the axes of the graph, including x, y-axis swapping, setting axis range, tick mark modification and removal, and so on. In order to play the graphics, axis processing proficiency is indispensable. Axis Swap
We use the Coord_flip () function to swap the axes.
Library (GGPLOT2)
Library (Gcookbook)
Ggplot (Plantgrowth, AES (X=group, Y=weight)) + Geom_boxplot ()
Ggplot (Plantgrowth, AES (X=group, Y=weight)) + geom_boxplot (
diagram. Facets can be compared by placing different subclasses in different graphs:Qplot (carat, data = diamonds, facets = Color ~., Geom = "Histogram", Binwidth = 0.1, Xlim = C (0, 3))Qplot (carat, data = diamonds, facets = Color ~., Geom = "Histogram", Binwidth = 0.1, Xlim = C (0, 3))The following graphic adds new elements based on the beginning: faceted, multiple layers, and statistics. Facets and layers extend the data structures mentioned above: each layer of each facet has its own datase
Ggplot2 Scale Related SettingsScale settings: Mainly used to adjust settings for each layer after Ggplot drawing.1. Related attribute scale settingIncludes Scale_size (), Scale_alpha (), Scale_shape ()As you can see from the name above, these three settings are primarily related to the Ggplot layer properties, including size, transparency, and shape.The main parameters for this setting are listed below:SCALE_XXX (name = Waiver (), breaks = waiver (),
Distribution in R should be regarded as a relatively important content, and by drawing to show the distribution of data, you can more intuitively let us understand the distribution of dataHistogramGeom_histogram (mapping = NULL, data = NULL, stat = "bin", Position = "stack", ..., binwidth = null, bins = NULL, NA.RM = F Alse, show.legend = NA, Inherit.aes = TRUE)Density mapgeom_density (mapping = NULL, data = NULL, stat = "density", Position = "identity", ..., na.rm = FALSE, show.legend = na, I N
Introduction
A line chart is generally used to describe a variable of one-dimensional variables as a continuous variable, which is usually time. In other words, a line chart is best suited to describe changes in time series data. Of course, with the change of discrete variables is also possible, but this discrete variable must be ordered. Draw a line chart
A basic line chart is relatively simple, as long as the AES in the Ggplot x,y data and Geom designated as line. If x is a continuous variable
more people are starting to use Python to do data analysis, IPython notebook is particularly popular, its real-time interaction to the scripting language advantage to play to the extreme. So how can you use Ggplot in Ipython notebook? I am here to share with you three different ways for you to choose.RPy2
The first is to use Rpy2, Rpy2 is a rewrite and redesign of Rpy, designed to provide Python users with
developed similar products with the Canadian team, based on HTML5 and D3, unfortunately, due to various reasons, the product cannot be pushed to the market)
More and more people are using python for data analysis. IPython Notebook is especially popular. its real-time interaction brings the advantages of scripting language to the extreme. So how can ggplot be used in IPython Notebook? I would like to share with you three different ways for you to choose.RPy2
The first method is to use
various reasons, the product cannot be pushed to the market)
More and more people are using python for data analysis. IPython Notebook is especially popular. Its real-time interaction brings the advantages of scripting language to the extreme. So how can ggplot be used in IPython Notebook? I would like to share with you three different ways for you to choose.RPy2
The first method is to use rpy2. rpy2 is to
to market)
Now more and more people are starting to use Python to do data analysis, IPython notebook is particularly popular, its real-time interaction has the advantage of scripting language to maximize. So how can you use Ggplot in Ipython notebook? I'm here to share three different ways for you to choose.RPy2
The first approach is to use Rpy2, Rpy2 is a rewrite and redesign of Rpy, designed to provide
, because if use properly, can multiply efficiency, if use is not good, the code readability is not good.
Like Magrittr.
and PipeR
The pipeline operation brings the operation of similar F # pipes to R, which facilitates many nested function operations. Python has an incomplete implementation,
/ http
Pandas.pydata.org/panda
S-docs/stable/whatsnew.html#pipe
, I feel that there is no R inside with smooth.
Similar to Ggplot2.
The syntax, + + + + operat
files, python clean source data processing, generate formatted files in a predetermined directory, do a timer let R read the file, the final output of statistical results and charts. This approach is somewhat feasible, in addition to making a timer, you can also let Python immediately execute "rscript" command invoke R script to work, but this method is too restrictive, only to exchange files, Python can not be precise control of R. 2. Let Python directly invoke R's function, R is an open sourc
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.