plotly

Using discrete custom color in a plotly heatmap

故事扮演 提交于 2019-11-30 17:54:50
问题 I'm trying to generate a plotly heatmap , where I'd like the colors to be specified by a discrete scale. Here's what I mean: Generate data with 2 clusters and hierarchically cluster them: require(permute) set.seed(1) mat <- rbind(cbind(matrix(rnorm(2500,2,1),nrow=25,ncol=500),matrix(rnorm(2500,-2,1),nrow=25,ncol=500)), cbind(matrix(rnorm(2500,-2,1),nrow=25,ncol=500),matrix(rnorm(2500,2,1),nrow=25,ncol=500))) rownames(mat) <- paste("g",1:50,sep=".") colnames(mat) <- paste("s",1:1000,sep=".")

Interactive scatter plots in R, overlay/hover summary/tooltip as user supplied plot function

╄→尐↘猪︶ㄣ 提交于 2019-11-30 17:11:38
问题 I have been looking into interactive plots in R. I know that there are several packages to create interactive plots, especially scatterplots, but I am looking for a certain functionality. For example this plot. One can hover with the mouse over the buttons to get a small numerical summary of the data behind the point, i.e. a tooltip. When you have a data set with more variables, it is often nice to explore/visualize scores from PCA, or do multi-dimensional-scaling(MDS). But if one would plot

Use bsModal in the shinyBS package with plotly R plotly_click to generate new plot in pop up

徘徊边缘 提交于 2019-11-30 16:28:11
Here is my code for a basic shiny app using plotly_click event to optionally show another plot. I would like that side box plot to render in a modal pop up instead of on the side within the page. library(shiny) library(plotly) df1 <- data.frame(x = 1:10, y = 1:10) df2 <- data.frame(x = c(rep('a', 10), rep('b', 10)), y = c(rnorm(10), rnorm(10, 3, 1))) ui <- fluidPage( column(6, plotlyOutput('scatter')), column(6, plotlyOutput('box')) ) server <- function(input, output) { output$scatter <- renderPlotly({ plot_ly(df1, x = x, y = y, mode = 'markers', source = 'scatter') }) output$box <-

Edit labels in tooltip for plotly maps using ggplot2 in r

自古美人都是妖i 提交于 2019-11-30 14:53:43
I know this question has been asked a number of times but I think some of the underlying syntax for plotly has changed since those questions have been asked. Using ggplotly() to create a choropleth map gives the default tooltip of long, lat, group, and one of my variables from my aesthetics. I understand that tooltip maps only whats in the aesthetics. All I want to do is to customize the tooltip so it displays some of the variables in my dataset (including those not mapped to aesthetics) and not others (such as the coordinates). Below is a reproducible example and what I've tried so far. I

Plotly Maps Not Rendering in R

时间秒杀一切 提交于 2019-11-30 14:19:06
I have successfully installed the plotly library for R. To get started, I followed their Getting Started for R guide and directly copied the code from several plots in my RStudio Version 0.99.489. The examples for scatterplots, box plots, etc. work well. The examples for bubble and choropleth maps do not plot properly. The maps do not render at all. Only title and legend show after running the code. Links to the code are here: https://plot.ly/r/bubble-maps/ https://plot.ly/r/choropleth-maps/ Can anyone help? Thanks in advance. EDIT: Tools: Plotly Library 2.016 for R R Studio Version 0.99.489 R

Removing the Edit Chart link from an R plotly graph

淺唱寂寞╮ 提交于 2019-11-30 13:32:01
问题 Is there a way to remove/hide the 'Edit Chart' link that appears in the bottom right half of your graph in the R version of Plotly? 回答1: From the documentation, use config : Plotly object p p %>% config(showLink = F) You can see .js config options in action here. Note: the "save and edit plot in cloud" button in the Mode Bar at the top still exists. You can turn off the Mode Bar with config(displayModeBar = F) There is a request on GitHub to edit specific Mode Bar buttons. 回答2: Just to add to

How to plot pie charts as subplots with custom size with Plotly in Python

99封情书 提交于 2019-11-30 12:24:28
I've been trying to make a grid of subplots with custom size with Plotly(version 1.12.9) in Jupyter notebook(offline). There is nice examples in the Plotly website but all of them are with scattered plots. I modified one of them to make it look like the one I want to and it works with scatter plots: import plotly import plotly.offline as py import plotly.graph_objs as go py.init_notebook_mode(connected=True) labels = ['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen'] values = [4500,2500,1053,500] trace0 = go.Scatter(x=[1, 2], y=[1, 2]) trace1 = go.Scatter(x=[1, 2], y=[1, 2]) trace2 = go.Scatter

Plotly update data

柔情痞子 提交于 2019-11-30 11:13:16
Okay so i have the following code: var element = document.getElementById(scope.changeid); function getData(division,redraw) { var employeeData = []; if (!division) { $http.get(api.getUrl('competenceUserAverageByMyDivisions', null)).success(function (response) { processData(response,redraw); }); } else { $http.get(api.getUrl('competenceUserAverageByDivision', division)).success(function (response) { processData(response,redraw); }) } } function processData(data,redraw) { var y = [], x1 = [], x2 = []; data.forEach(function (item) { y.push(item.user.profile.firstname); x1.push(item.current_level)

Change a single point in a plotly scatter3d in R shiny

孤街醉人 提交于 2019-11-30 09:45:51
问题 I have an app where I am trying to change a point's size or color or symbol. The point being the object that the user has clicked. Clicking a point creates a popup in my program that shows another dataset linked to the ID value in a column belonging to the rownumber belonging to the point clicked. I included the flow of events in the demo app (without popups) for the click event. I'm trying to change the point based on the answer here for a plotly 2d scatter plot. However, applying the code

Direct labels and hover info to be different in plotly

守給你的承諾、 提交于 2019-11-30 09:40:28
问题 I have a stacked bar chart. On the segments in the bar chart I want to add the numbers (y values) and on hover I want some different information to be shown (not name or x or y values). Is it possible? From what I can see hoverinfo let's you only duplicate the values in text or add the name. import plotly from plotly.graph_objs import Layout, Bar hoverinformation = ["test", "test2", "test3", "test4"] # this info I would like it on hover data = [] for index, item in enumerate(range(1,5)): data