plotly

Displaying image on point hover in Plotly

别说谁变了你拦得住时间么 提交于 2019-11-28 11:07:37
Plotly allows you to display text fields when hovering over a point on a scatterplot. Is it possible to instead display an image associated with each point when the user hovers over or clicks on it? I am mostly just using the web interface, but I could instead push my ggplot from R. Unfortunately, there is no easy way to display images on hover on plotly graphs at the moment. If you are willing to learn some javascript, plotly's embed API allows you to customize hover (as well as click) interactivity. Here is an example of a custom hover interaction showing images on top of a plotly graph. The

Adding config modes to Plotly.Py offline - modebar

爷,独闯天下 提交于 2019-11-28 10:34:18
Plotly.js includes all the parameters needed to configure the ModeBar, which allows one to take away options from the display bar (such as the link to edit the graph online). However, this does not appear implemented in the Plotly.py API. In the js version: Plotly.newPlot('myDiv', data, layout, {displayModeBar: false}); Removes the modebar entirely. Plotly.newPlot('myDiv', data, layout, {displaylogo: false}, {modeBarButtonsToRemove: ['sendDataToCloud','hoverCompareCartesian']}) allows one to specify each button to remove which I'd like to implement. I've edited this as I've found a workaround.

Using 2+ legends from R to plotly / plot.ly

廉价感情. 提交于 2019-11-28 09:47:06
问题 I am using R's ggplot to create a static plot and pass that on to plot.ly to create an interactive plot. My aim to project a categorical variable to the color and a numeric variable to size. With R's [iris] data that works perfect - Like that: testplot <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color=Species, size=Petal.Length)) + geom_point() py$ggplotly(testplot) https://plot.ly/~SyTpp/11/sepalwidth-vs-sepallength/ Now, I have my own dataset, a, ... > a Country OR_Edu OR_Illn total num

clicking same plotly marker twice does not trigger events twice

女生的网名这么多〃 提交于 2019-11-28 09:15:30
问题 I am using Plotly's event_data("plotly_click") to do stuff (opening a modal) after the user clicked on a marker in a scatter plot. Afterwards (e.g. closing the modal), event_data("plotly_click") does of course not change and clicking on the same marker therefore does not trigger the same action again. Minimal example: library(plotly) ui <- fluidPage( plotlyOutput("plot") ) server <- function(input, output, session) { output$plot <- renderPlotly({ mtcars %>% plot_ly(x=~disp, y=~cyl) }) # Do

Smoothen heatmap in plotly

淺唱寂寞╮ 提交于 2019-11-28 09:09:45
问题 I wanted to create a heatmap of a probability density matrix using plotly. import numpy as np from plotly.offline import download_plotlyjs, init_notebook_mode, plot import plotly.graph_objs as go probability_matrix = np.loadtxt("/path/to/file") trace = go.Heatmap(z = probability_matrix) data=[trace] plot(data, filename='basic-heatmap') This gives me an image like this: I want to smoothen the color of the squares so that the transition between adjacent squares in the image are somewhat

date format in tooltip of ggplotly

不打扰是莪最后的温柔 提交于 2019-11-28 08:24:41
I am using ggplotly to show an interactive time-series plot. The x axis is in date format, yet the hover tool tip in plotly is converting the date format to a numeric (screenshot attached). Any ideas on how to get the date to show as a proper date in the tooltip? Below is a short piece of the code: output$ggplot <- renderPlotly({ plotbycity<-df_postgres %>% group_by(city, date, bedroooms) %>% filter(city %in% input$checkGroup & bedroooms==input$radio) %>% summarise(count=n(),rent=median(rent)) %>% ungroup() plotbycity$date<-as.Date(plotbycity$date) # Error handling plotbycity<-plotbycity[!is

visualize plotly charts in spyder

南楼画角 提交于 2019-11-28 08:20:45
问题 Since November 2015, plotly is Open-Source and available for python. https://plot.ly/javascript/open-source-announcement/ When trying to do some plots offline, these work in iPython Notebook (version 4.0.4) But if I try to run them in Spyder (version 2.3.8), i just get the following output: <IPython.core.display.HTML object> <IPython.core.display.HTML object> There's something wrong in my code or the iPython Terminal of Spyder still doesn't support this? Here goes the example code (taken from

Removing plotly click event data

限于喜欢 提交于 2019-11-28 07:48:58
问题 I am designing a Shiny app which contains a plotly scatter plot. I would like for the user to be able to click on the graph to record an event using the event_data function, but then be able to clear that event on the click of an actionButton . Some example code can be seen below: library(shiny) library(plotly) ui <- fluidPage( actionButton("clearEvent", label = "clear event"), verbatimTextOutput("plotVal"), plotlyOutput('plot1') ) server <- function(input, output, session) { output$plot1 <-

Shiny update the clicked point to highlight it

浪尽此生 提交于 2019-11-28 05:55:36
问题 Here is a working example of extracting the on-click event. I would like to ask you if there is a way to update the clicked point with either increase in size or highlight it etc.,? library(shiny) library(plotly) ui <- fluidPage( plotlyOutput("plot"), verbatimTextOutput("click") ) server <- function(input, output, session) { nms <- row.names(mtcars) output$plot <- renderPlotly({ p <- ggplot(mtcars, aes(x = mpg, y = wt, col = as.factor(cyl), key = nms)) + geom_point() ggplotly(p) }) output

Formatting mouse over labels in plotly when using ggplotly

戏子无情 提交于 2019-11-28 05:00:01
I am struggling with text formatting when using ggplotly and the mouse over functionality. library(plotly) df <- data.frame(a=letters, b=LETTERS, x=runif(26), y=runif(26)) g <- ggplot(df, aes(x,y)) + geom_point(aes(text=sprintf('letter: %s\nLetter: %s', a, b))) g (gg <- ggplotly(g)) I would like to have some formatted text or at least a newline in my mouse over label. Is there a good documentation on how to design this mouse over bubble thing? plotly can make use of the line break HTML tag. You can get what your after using the <br> tag for a newline: g <- ggplot(df, aes(x,y)) + geom_point(aes