# Draw Your Breast with CloudStat – A R Apps (for fun)

**CloudStat**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This is a simple apps, called “Draw Your Breast with R“ created with R to generate Breast alike graphics.

With this **Draw Your Breast with R** apps, you can change 4 parameters which are Theta, Phi, Expand and Color to generate graphics like below:

When you go to Draw Your Breast with R , you will see something like

How’s your breast looked like?

Θ:

Φ:

Expand:

Color:

Execute

You can edit the 4 parameters and click “Execute” button to get graphical result immediately.

The** theta** is the parameter for “area of breast”.

The **phi** is the “upside-down” parameter.**Expand** is the “height of breast”.

Last but not least, **color** parameter.

**For developers:**

This is the original 2D breast:

x=seq(from=0,to=1,by=0.01)

c=3*x*log10(x)-(1/30)*exp(1)**-((30*x-30/exp(1))**4)

d=2.5*x*log10(x)-(1/36)*exp(1)**-((36*x-36/exp(1))**4)

e=2*x*log10(x)-(1/50)*exp(1)**-((50*x-50/exp(1))**4)

plot(e,x,type=”lines”, col = “red”, xlim=c(-1, 0) , ylim=c(0, 1))

lines(d,x, col = “red”)

lines(c,x, col = “red”)

which will generate result:

3D source code:

a1<-seq(0,2,0.01)

b1<-seq(0,1,0.01)

f<-function(a1,b1) ifelse(a1<=1, 11*a1*log10(a1)*b1*(b1-1)+exp(-((25*a1-25/exp(1))^2+(25*b1-25/2)^2)^3)/25, 11*(a1-1)*log10(a1-1)*b1*(b1-1)+exp(-((25*(a1-1)-25/exp(1))^2+(25*b1-25/2)^2)^3)/25)

c1<-outer(a1,b1,f)

plot(1)

persp(a1,b1,c1,theta=30,phi=30,expand=0.5,col=”red”)

Result:

Now, we want to turn the 3D version to be a customized version apps.

To create a new R apps, please Login/Register and go to Builder.

You will see 2 important area, which are **Code** and **Application**.

For Code area (Backend), please paste:

[—hidestart—]

a1<-seq(0,2,0.01)

b1<-seq(0,1,0.01)

f<-function(a1,b1) ifelse(a1<=1, 11*a1*log10(a1)*b1*(b1-1)+exp(-((25*a1-25/exp(1))^2+(25*b1-25/2)^2)^3)/25, 11*(a1-1)*log10(a1-1)*b1*(b1-1)+exp(-((25*(a1-1)-25/exp(1))^2+(25*b1-25/2)^2)^3)/25)

c1<-outer(a1,b1,f)

[—hideend—]

plot(1)

[—hidestart—]

persp(a1,b1,c1,theta=[—||theta||—],phi=[—||phi||—],expand=[—||expand||—],col=”[—||colour||—]”)

[—hideend—]

For Application area (Frontend), please paste:

How’s your breast looked like?

\( \Theta \): [—||theta||30,10,20,30,40,50,60,70,80,90,100,150,200||—]

\( \Phi \): [—||phi||30,10,20,30,40,50,60,70,80,90,100,150,200||—]

Expand: [—||expand||0.5,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5||—]

Color: [—||colour||red,blue,yellow,green,black,purple,grey,orange,pink,gold,brown,white||—]

Then, published it.

You will get another alike **Draw Your Breast with R** apps!

Hope you enjoy this apps and tutorial, feel free to suggest and FAQ to improve this apps. Thanks!

Note:

- [—hidestart—] with [—hideend—] are a set of tag to hide the code in between from the result.
- If you are using LATEX, you should start with “
**\(**” and end with “**\)**” - [—||VARIABLE||OPTION1,OPTION2,OPTION3||—] is a function-option tag, not an original R code.

**leave a comment**for the author, please follow the link and comment on their blog:

**CloudStat**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.