Amazing plot: Difference between revisions

From 太極
Jump to navigation Jump to search
Line 38: Line 38:


[https://lorentzen.ch/index.php/2021/12/20/x-mas-tree-with-10-lines-of-r-code/ X-Mas Tree with 10 Lines of R Code]
[https://lorentzen.ch/index.php/2021/12/20/x-mas-tree-with-10-lines-of-r-code/ X-Mas Tree with 10 Lines of R Code]
= Plant =
[https://twitter.com/SciPyTip/status/1554290482263592960?s=20&t=AQv_jIEc0_DdoDW5kN_n0A interactive trigonometric plant], [https://t.co/o1qvAg1KzJ Shiny for Python]


= Happy Thanksgiving =
= Happy Thanksgiving =

Revision as of 20:07, 3 August 2022

New R logo 2/11/2016

library(sp)
library(maptools)
library(ggplot2)
library(ggthemes)
# rgeos requires the installation of GEOS from http://trac.osgeo.org/geos/
system("curl http://download.osgeo.org/geos/geos-3.5.0.tar.bz2 | tar jx")
system("cd geos-3.5.0; ./configure; make; sudo make install")
library(rgeos)
 
r_wkt_gist_file <- "https://gist.githubusercontent.com/hrbrmstr/07d0ccf14c2ff109f55a/raw/db274a39b8f024468f8550d7aeaabb83c576f7ef/rlogo.wkt"
if (!file.exists("rlogo.wkt")) download.file(r_wkt_gist_file, "rlogo.wkt")
rlogo <- readWKT(paste0(readLines("rlogo.wkt", warn=FALSE))) # rgeos
 
rlogo_shp <- SpatialPolygonsDataFrame(rlogo, data.frame(poly=c("halo", "r"))) # sp
rlogo_poly <- fortify(rlogo_shp, region="poly") # ggplot2
 
ggplot(rlogo_poly) + 
  geom_polygon(aes(x=long, y=lat, group=id, fill=id)) + 
  scale_fill_manual(values=c(halo="#b8babf", r="#1e63b5")) +
  coord_equal() + 
  theme_map() + 
  theme(legend.position="none")

3D plot

Using persp function to create the following plot. Code in github.

3dpersp.png

Christmas tree

http://wiekvoet.blogspot.com/2014/12/merry-christmas.html. Code in github.

XMastree.png

X-Mas Tree with 10 Lines of R Code

Plant

interactive trigonometric plant, Shiny for Python

Happy Thanksgiving

Turkey

Turkey.png

Happy Valentine's Day

treemap

http://ipub.com/treemap/

TreemapPop.png

Voronoi diagram

Silent Night

Silentnight.png

The code in github.

The Travelling Salesman Portrait

https://fronkonstin.com/2018/04/04/the-travelling-salesman-portrait/

Moon phase calendar

https://chichacha.netlify.com/2018/05/26/making-calendar-with-ggplot-moon-phase-calendar/

Calendar heatmap

https://stackoverflow.com/questions/26171068/add-dates-to-calendar-heat-map-r

Chaos

Rcpp, Camarón de la Isla and the Beauty of Maths

Mosaic

Photo Mosaics in R

Analog clock

Useless analog and digital clocks