Skip to content

Instantly share code, notes, and snippets.

@vaidehijoshi
Last active April 15, 2017 00:09
Show Gist options
  • Save vaidehijoshi/9f214e600dca8943ffb1ffe493266d67 to your computer and use it in GitHub Desktop.
Save vaidehijoshi/9f214e600dca8943ffb1ffe493266d67 to your computer and use it in GitHub Desktop.
# To install plotly: install.packages('plotly')
# To ensure you have plotly: library(plotly)
# Import your dataset. You can use this script to generate a CSV for an entire month's worth of data:
# https://gist.github.com/vaidehijoshi/5bb92c2a3656d8b72fc731bb0d2bf243
# R Studio should recgonize your dataset automatically when you upload it, but if not, you can do something like this:
monthly_endpoint_percentages <- read.table('~/Code/scatter_plot_data.csv', sep=",", header=TRUE)
# If you want to graph the endpoints as compared to their app rpm's, use this command:
plot_ly(data=monthly_endpoint_percentages, type="scatter", x=~app_rpm, y=~endpoint_percentage)
# If you'd like the hover text to also display the app_id, you can add `text=~app_id`.
# Just be sure that your CSV actually has this column, before running this command.
plot_ly(data=monthly_endpoint_percentages, type="scatter", x=~app_rpm, y=~endpoint_percentage, text=~app_id)
# If you want to graph the logarithmic version of this data, make sure that you only have numeric values in your dataset.
# tl;dr -- remove the app_id from the CSV in order to make this work.
plot_ly(data=log(monthly_endpoint_percentages_without_app_id), type="scatter", x=~app_rpm, y=~endpoint_percentage)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment