plotly

Major and minor tickmarks with plotly

风格不统一 提交于 2019-12-07 10:26:58
问题 I would like to generate a figure in plotly like the following figure generated with the base R graphics: The R code for the figure above is the following: x = c(1,2,3,4,5) y = c(0.1, 1, 10, 100, 1000) axseq = y plot(x, log10(y), yaxt="n") axis(2, at=log10(axseq), labels=as.character(axseq)) for (i in 1:5){ bb = 1:10; a = (bb*10^(i-2)); axis(2, at=log10(a), tcl=-0.25, labels=F) } My plotly code for the same figure so far is the following: p = plot_ly(x=x, y=log10(y), mode="markers") %>%

Plotly gives an empty field as output in jupyter lab

天涯浪子 提交于 2019-12-07 09:50:37
问题 I'm using plotly at jupyter lab, but I'm getting a blanked output. I'm having exactly the same problem described here: plotly.offline.iplot gives a large blank field as its output - why? And I tried what they suggested in the answers, but it didn't work. Here is the code I'm using: import pandas as pd import numpy as np %matplotlib inline from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot init_notebook_mode(connected=True) cf.go_offline() df = pd.DataFrame(np.random

r plotly 3d surface plot issue

元气小坏坏 提交于 2019-12-07 09:47:06
问题 I am trying to plot a 3d surface plot based on these plotly examples When I try these examples on my dataset test_plotly = structure(list(Age = c(82L, 82L, 83L, 83L, 83L, 81L, 81L, 81L, 79L, 80L, 82L, 78L, 78L, 79L, 78L, 80L, 79L, 77L, 77L, 77L, 77L, 78L, 76L, 77L, 77L, 78L, 77L, 76L, 83L, 79L, 76L, 84L, 75L, 75L, 77L, 74L, 74L, 75L, 74L, 74L, 73L, 73L, 74L, 81L, 84L, 73L, 72L, 73L, 71L, 71L, 73L, 72L, 79L, 72L, 71L, 76L, 72L, 75L, 73L, 71L, 70L, 79L, 69L, 70L, 70L, 70L, 77L, 69L, 69L, 68L,

Display python plotly graph in RMarkdown html document

依然范特西╮ 提交于 2019-12-07 09:08:57
问题 Why plotly package of python can not display figure in RMarkdown but matplotlib can? For example: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE) ``` ```{r} library(plotly) subplot( plot_ly(mpg, x = ~cty, y = ~hwy, name = 'default'), plot_ly(mpg, x = ~cty, y = ~hwy) %>% add_markers(alpha = 0.2, name = 'alpha'), plot_ly(mpg, x = ~cty, y = ~hwy) %>% add_markers(symbols = I(1), name = 'hollow') ) ``` ```{python} import plotly import plotly.plotly

Import Plotly.js in Angular

别等时光非礼了梦想. 提交于 2019-12-07 09:00:41
问题 I followed the instructions from this SO answer to integrate plotly in the application. Unfortunately I experience typescript errors, when trying out the standard examples of plotly.js. The argument types of Plotly.newPlot(...) seem to be not correct. Here is my component: import {Component, OnInit} from '@angular/core'; import * as Plotly from 'plotly.js'; import {Config, Data, Layout} from 'plotly.js'; @Component({ selector: 'app-tabs', templateUrl: './tabs.component.html', styleUrls: ['.

How to apply plotly.js to an existing svg group <g> as target instead of applying it to a target <div> element?

风格不统一 提交于 2019-12-07 08:38:27
If there is a target div in my DOM, e.g. <div id="graph"></div> I can use plotly to create a plot in that div (a full example is below): Plotly.newPlot('graph', data, layout); This will create a nested structure in the div that contains an svg element. Tn that svg element there is a contour plot, represented by some elements (see DOM structure below). That works fine. However, I have an already existing svg element (created with d3.js) and I would like to include a contour plot from plotly in my target svg group : <div id="myDiv"> <svg id = "mySvgElement"> ... <rect id="someExistingContent"><

Scaling plotly figures in knitr Latex document

流过昼夜 提交于 2019-12-07 08:08:58
问题 I'm trying to include a plotly chart into a Latex document with knitr. Since knitr includes the webshot package this works well. But if I want to resize my figure for the latex output, the figure environment gets bigger but the plotly chart is not scalled to the manually set figure width and height. Specifing the webshot options like recommend here, did not work neither. Scaling a ggplot chart works well, but how can I get the same results for the plotly chart? \documentclass{article}

Plotly python offline - visit url on click?

空扰寡人 提交于 2019-12-07 08:01:06
问题 Is it possible to configure a plotly plot so that the user is taken to a specific url when they click on a certain data point? My intended usage is for bar charts: I'd like to be able to click on a bar and then be taken to a url, each bar being configured with a different url. I'm using plotly python offline to create a <div> which I'm embedding in a website. Is this possible with the postMessage API on plotly python offline mode? 回答1: Here I have created an example for you to edit here -

Color in plotly bar chart

為{幸葍}努か 提交于 2019-12-07 06:21:23
问题 I'm trying to generate a bar plot using plotly in R. The bars should be sorted by value and there are two classes of bars, which I want to color differently. However, when I add the color, the bars are split into two groups, sorted within groups. Any hint on how I can keep them in one group? Here's my code: plotting.df = data.frame(names=c("a", "b", "c", "d", "e", "f", "g"), value=c(1.9468656, 1.3867055, 1.0433950, 0.8949743, 0.3714826, 0.3605037, 0.3003954), label=c("y", "n", "y", "n", "n",

Add vertical line to ggplotly plot

时光毁灭记忆、已成空白 提交于 2019-12-07 05:51:30
问题 I am trying to build a plot combining ggplot2 and plotly . The two vertical lines appear on pure ggplot2, but once I call plotly::ggplotly on it, they go away. How can I make the data also appear on the ggplotly version? If you have a solution using only plot_ly , that would be fine too. The data: df <- structure(list(date = structure(c(17226, 17257, 17287, 17318, 17348, 17379, 17410, 17440, 17471, 17501, 17226, 17257, 17287, 17318, 17348, 17379, 17410, 17440, 17471, 17501, 17226, 17257,