# Prototype: More Web-Friendly Visualizations in R

**TechPolicy.ca » R**, 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.

I’ve spent some more time thinking about how best to put together the package for creating web-friendly, interactive data visualizations in R. I have a pretty substantial JavaScript package that does a lot of basic visualizations now, and it’s really exciting to see where this is going. With this in mind, I’m releasing a new version of the R package prototype I keep discussing in this blog.

A number of functions are included here, including *wv.plot()*, *wv.lineplot()*, *wv.snaplot()*, *wv.bargraph*. The documentation still needs a lot of work, and there are no interactive abilities yet (though they exist in the JavaScript code).

What is most exciting about this package is that a lot of the steps one takes to make a complete graph have been split into individual functions. Thus, while one can make a scatterplot with *wv.plot()*, one can also use *wv.axis()* and *wv.points()* to do so as well. Each data visualization gets its own ID, or can be assigned one, so one can later start passing visualization (e.g. the points in the scatterplot itself) as arguments to other functions, thus allowing one to begin adding functions for interactivity.

A few examples of the visualizations are shown below, along with the necessary R code to get them to display. Note that these are embedded into the blog, I did so through the use of an inline frame.

**Basic Scatterplot**

The code below will generate a basic scatterplot.

`x = rnorm(30)`

```
```y = rnorm(30)

`wv.plot(x, y, "~/Desktop/scatterplot", height=300, width=300, xlim=c(-2.5,2.5), ylim=c(-2.5,2.5), xbreaks=c(0), ybreaks=c(0))`

**Plot with Multiple Data Types**

Supposing you want to have a scatterplot with multiple point types and a line. You can build this manually with the following code.

`x = rnorm(30); y = rnorm(30); z = runif(30);`

```
```wv.open("~/Desktop/plot3/", height=300, width=300);

wv.axis(c(-3.5, 3.5), c(-3.5, 3.5), xbreaks=-2:2, ybreaks=-2:2);

wv.points(x, y, xlim=c(-3.5, 3.5), ylim=c(-3.5, 3.5));

wv.lines(sort(x), z, col="red", xlim=c(-3.5, 3.5), ylim=c(-3.5, 3.5));

`wv.close();`

**Bar Graph**

This is a new graph format.

`x = c(2.5, 7, 11);`

```
```

`wv.bargraph(x, cats, "~/Desktop/barplot", ylim=c(0, 15), ybreaks=(1:5)*3);`

As always, comments are welcome.

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

**TechPolicy.ca » R**.

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.