Objective:Learn two variable analysis flow by exploring file PSEUDO_FACEBOOK.TSV dataKnowledge Points:1.ggplot syntax2. How to make a scatter chart3. How to optimize scatter plots4. Condition mean value5. Correlation of variables6. Sub-hubs diagram7. SmoothingBrief introduction:If you are exploring a single variable using a histogram to represent the relationship between the value and the whole, then using a scatter plot is more appropriate to explore
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
method parameter, which defaults to method= "loess"-smoothing local regression. Parameter span controls how smooth the curve is, and the larger the value the more smoothly the curve.
> Qplot (Carat,price,data=sample,geom=c ("point", "smooth"), span=.3)
Use Qplot () to draw a more beautiful histogram of the variable carat:
> Qplot (carat,data=diamonds,geom= "Histogram", Binwidth=.1,xlim=c (0,3), Fill=color)
4.6.2 Sub-layer drawing(1) Data and mappingsGgplot (Data,mapp
Library (' Ggplot2 ')DF #用glmLogit.fit Logit.predictions Mean (with (df, logit.predictions = = Label))#正确率 0.5156, with the same results as the guess.Library (' e1071 ')Svm.fit Svm.predictions Mean (with (df, svm.predictions = = Label))#改用SVM, correct rate 72%Library ("reshape")#df中的字段, X,Y,LABEL,LOGIT,SVMDF #melt的结果, increase the field variable, where the value is LABEL,LOGIT,SVM, increment the field value, and take the corresponding value according to variable#melt函数: Specify the variable, and
GGS-DDU
Time Limit: 2000/1000 MS (Java/others) memory limit: 131072/131072 K (Java/Others)Total submission (s): 324 accepted submission (s): 171
Problem descriptiondo you think this is a strange problem name? That is because you don't know its full name --- 'good good study and day up! ". Very famous sentence! Isn' t it?
Now "GGS-DDU" is lzqxh's target! He has n courses and every course is divided into a plurality of levels. Just like college English have level 4 and Level 6.
To simplify the
grouping. The production process of frequency distribution table is described in detail in the article "R actual combat nineth: List and Frequency table", no longer repeat.
Library (GRID) library (VCD) labels"","30-40","40-50","50-60","60-70",">=") Breaks1, -, +, -, -, -, -) MyTableTRUE) DF as. data.frame (Table (age=mytable)) DFprop.table (Freq)) DFcumsum (freqrate)) DF -,2), cumfreqrate= round (cumfreqrate* -,2))
(2) Plotting frequency distribution histogram
To draw a histogram of frequency d
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
data:The Diamonds dataset in Ggplot2, using a random sample to fetch 1000 samples, the code is as follows:> Library (GGPLOT2)> Data ("Diamonds")> Head (Diamonds)> set.seed (1234)> Small Histogram> Ggplot (Small) +geom_histogram (Aes (X=price), fill= "Cornflowerblue", colour= "Black", binwidth= 1000)Stacked HistogramUse the "Cut" column in the data (divided into 5 grades, used to differentiate the quality of the diamond) to make a stacked histogram as
Watervoles data from the HSAUR2 package for example. This data is a similarity matrix, which indicates the similarity of paddy rats in different regions. Load the data first and then analyze it with cmdscales.Library (GGPLOT2) data (watervoles, package = "HSAUR2") data (Watervoles) Voles.mds=cmdscale (watervoles,k=13,eig=t)The following calculates the proportions of the first two eigenvalues in all eigenvalues, in order to detect whether the distance in the high-dimensional space can be represe
Directory:Initial pattern How to modify the width of a bar how to change the order of bars how to add text to a bar
(For more on the legend, coordinate system, etc. see: R, Ggplot2, shiny summary)
Initial pattern:
Library (GGPLOT2)
Library (ggthemes)
dt = data.frame (obj = C (' A ', ' D ', ' B ', ' E ', ' C '), val = C (2,15,6,9,7))
p = Ggplot (DT, AES (x = obj, y = val, fill = obj, group = factor (1))) +
Geom_bar (stat = "identity") +
theme
Directory:
Initial pattern
How to modify the width of bar bars
How to modify the order of bar bars
How do I add text to the bar
(For more information on legends, coordinate systems, etc. see: R, Ggplot2, shiny summary)Initial pattern:library(ggplot2)library(ggthemes)dtdata.frame(obj = c(‘A‘,‘D‘,‘B‘,‘E‘,‘C‘), val = c(2,15,6,9,7))p = ggplot(dt, aes(x = obj, y = val, fill = obj, group = factor(1))) + "identity") + theme_e
each component name in a picture
Draw multiple pictures
Import NumPy as NP
import Matplotlib.pyplot as Plt
plt.style.use ("Ggplot") # display style
def f (t):
return Np.exp (-T) *np.cos (2*np.pi*t)
t1 = Np.arrange (0.0,5.0,0.1)
t2 = Np.arrange (0.0,5.0,0.02)
plt.figure (1) # Create a figure
Plt.subplot (211) # Create a 2-row 1-column diagram on the figure, and currently select 1th Figure
# Draw (t1,f (T1)) and (T2,f (T2)), one in a curved form,
format only show hours ggplot(message,aes(x=time,y=size)) + geom_line() + labs(title="时间-流量图",y=‘size(KB)‘) + scale_x_datetime(breaks=date_breaks("1 hour"),labels= date_format("%H")) Save picture ggsave(filename=‘e:/R/时间-流量图-分.jpg‘,width=15,height=8) Statistics URL Access times graph ggplot(message)+ geom_bar(aes(x=url)) + coord_flip() + labs(x=‘url‘,y=‘count‘) Pie chart
"""This example demonstrates the ' Ggplot ' style, which adjusts the style toemulate ggplot_ (a popular plotting package fo R r_). These settings were shamelessly stolen from [1]_ (with permission) ... [1] http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/. _ggplot:http://had.co.nz/ggplot/. _r:http://www.r-project.org/"""ImportNumPy as NPImportMatplotlib.pyplot as Pltplt.style.use ('
/PREDBLOG.RMD# #载入需要的包require (XML) require (DPLYR) require (Tidyr) require (READR) require (mosaic) require (Rcurl) require (GGPLOT2) Require (lubridate) require (Rjsonio) # #数据拉取url = "http://projects.fivethirtyeight.com/2016-election-forecast/ national-polls/"Doc View all selection data: AllolldataFast VisualizationIt is necessary to simply look at the data before figuring out the proportion of the projected votes for the 2016 U.S. presidential campaign. The data set has been collated and vis
Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming... Reply: many good-looking PYTHON libraries are developed and encapsulated based on matplotlib!
I have used seaborn, bokeh, and
0 reply: many good-looking PYTHON image libraries are developed and encapsulated based on matplotlib!
I have used seaborn, bokeh, and ggplot databases!
Seaborn is biased towards statistical plot, especially linear plot, which is easy to use and simple. The entire syntax layer of seaborn will also be much simpler, and it looks nice to draw a picture without any modification. However, the drawing method is limited and not flexible enough.
Bokeh uses js
). Learning pandas you have to master is:
Summarize and calculate descriptive statistics, process missing data, hierarchical indexes
Clean, transform, merge, reshape, GroupBy technology
Date and time data types and tools (date processing easy to fly)
See blog: http://www.cnblogs.com/chaosimple/p/4153083.htmlthree. Matplotlib:The most famous drawing system in Python, many other drawings such as Seaborn (for pandas drawings) are also encapsulated by them. John Hunter, a found
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.