Giter Site home page Giter Site logo

yixf-self / plotly Goto Github PK

View Code? Open in Web Editor NEW

This project forked from plotly/plotly.r

0.0 2.0 0.0 66.99 MB

Create interactive web graphics from R via plotly's JavaScript graphing library

Home Page: https://plot.ly/r/

License: Other

R 98.95% CSS 0.05% JavaScript 1.00%

plotly's Introduction

Build Status

plotly

An R package for creating interactive web graphics via plotly.js.

Installation

Install from CRAN:

install.packages("plotly")

Or install the latest development version (on GitHub) via devtools:

devtools::install_github("ropensci/plotly")

Getting Started

Web-based ggplot2 graphics

If you use ggplot2, ggplotly() converts your plots to an interactive, web-based version! It also provides sensible tooltips, which assists decoding of values encoded as visual properties in the plot.

library(plotly)
g <- ggplot(faithful, aes(x = eruptions, y = waiting)) +
  stat_density_2d(aes(fill = ..level..), geom = "polygon") + 
  xlim(1, 6) + ylim(40, 100)
ggplotly(g)

https://plot.ly/~cpsievert/9836

If you'd like to see how ggplotly() does in converting different ggplot2 examples, we host a plotly version of the official ggplot2 documentation. We also have some of our own examples here.

plotly's custom R interface

plotly supports some chart types that ggplot2 doesn't (such as 3D surface, point, and line plots). You can create these (or any other plotly) charts using plot_ly().

plot_ly(z = volcano, type = "surface")

https://plot.ly/~brnvg/1134

For a more concise overview of the plot_ly() interface, see here. You might also find our examples and the figure reference to be helpful.

Hooking onto plotly events

plotly.js exposes a number of 'standard' events that work consistently across plot types. It's easy to hook into these events using the event_data() function in shiny apps, as these examples demonstrate:

  1. 2D events (source)
  2. Linked Clicks (source)
  3. Linked Brush (source)

http://104.131.111.111:3838/plotlyLinkedBrush/

You can also hook into these events without shiny using htmlwidgets::onRender() (example). This, however, requires JavaScript knowledge and makes it much harder, if not impossible, to coordinate views between htmlwidgets.

Contributing

Please read through our contributing guidelines. Included are directions for opening issues, asking questions, contributing changes to plotly, and our code of conduct.


plotly's People

Contributors

cpsievert avatar mkcor avatar tdhock avatar pedrodz avatar chriddyp avatar 13bzhang avatar karthik avatar sckott avatar msund avatar talgalili avatar timelyportfolio avatar jcheng5 avatar charliejhadley avatar mplourde avatar nikolai-hlubek avatar

Watchers

Yi Xianfu avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.