plotly

Rendering MATLAB patch faces with Plotly fig2plotly()

这一生的挚爱 提交于 2019-12-10 01:06:50
问题 Problem: When attempting to export a polygon rendered with the patch command in MATLAB with fig2plotly , the final output is lacking the specified face colours. Perhaps a demonstration would help. Take the following vertices and faces to define a cube (lifted from the MATLAB documentation): vert = [0 0 0;1 0 0;1 1 0;0 1 0;0 0 1;1 0 1;1 1 1;0 1 1]; fac = [1 2 6 5;2 3 7 6;3 4 8 7;4 1 5 8;1 2 3 4;5 6 7 8]; And render it with the patch command, adding some colour information to the faces: patch(

Removing the borders in geom_boxplot in ggplot2

蓝咒 提交于 2019-12-09 18:33:59
问题 This should seem relatively straightforward but I can't find an argument which would allow me to do this and I've searched Google and Stack for an answer. Sample code: library(ggplot2) library(plotly) dat <- data.frame(cond = factor(rep(c("A","B"), each=200)), rating = c(rnorm(200),rnorm(200, mean=.8))) p <- ggplot(dat, aes(x=cond, y=rating, fill=cond)) + geom_boxplot() p <- ggplotly(p) This outputs the first graph, I would want something like the second. I tried including colour=cond but

R - plotly - combine bubble and chorpleth map

梦想与她 提交于 2019-12-09 13:49:25
问题 I would like to combine two types of maps within one map in plotly, namely bubble and choropleth map. The objective is to show population size on a country level (choropleth) as well as on a city level (bubble) by hovering with the mouse over the map. The plotly example code for a choropleth map is as follows: library(plotly) df <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_world_gdp_with_codes.csv') # light grey boundaries l <- list(color = toRGB("grey"), width =

Individually labeled bars for bar graph in Plotly

孤者浪人 提交于 2019-12-09 12:59:43
问题 I was trying to create annotations for grouped bar charts - where each bar has a specific data label that shows the value of that bar and is located above the centre of the bar. I tried a simple modification of the examples in tutorial to achieve this, as follows: import plotly.plotly as py import plotly.graph_objs as go x = ['Product A', 'Product B', 'Product C'] y1 = [20, 14, 23] y2 = [12, 18, 29] annotations1 = [dict( x=xi, y=yi, text=str(yi), xanchor='auto', yanchor='bottom', showarrow

Custom tooltip positioning

空扰寡人 提交于 2019-12-09 12:09:48
问题 I'm facing issues to properly position a custom tooltip on a Plotly.js heatmap. I'm using the l2p method (what's this acronym standing for?) in combination with the pointNumber data to get a relative positioning within the heatmap. It looks like: x: point.xaxis.l2p(point.pointNumber[1]), y: point.yaxis.l2p(point.pointNumber[0]) But the problem with that is that it is relative to the top/left origin of the heatmap svg itself without the outer x- and y-axis labels, so I'm actually missing that

Download multiple plotly plots to PDF Shiny

南楼画角 提交于 2019-12-09 11:42:54
问题 My Shiny App displays a plotly plot for whatever input the user selects. I want a download button that saves ALL the plots inside a PDF file on the user's system. I'm using R markdown for knitting a PDF report and then donwloading it using downloadHandler in Shiny. As of now, I can create each plot individually in my Shiny code and then pass them as a list of parameters to my r markdown file. Since I have a large number of plots (>25) in my actual project, I want to do it in a loop. Here's a

Using plot.ly in jupyterlab - graphics does not show

ぐ巨炮叔叔 提交于 2019-12-08 19:38:05
问题 I want to draw 3D PCA with pylot ( Scatter3d ), however the graphics is not showing up in jupyterlab only in jupyter-notebook . I've installed the 'jupyterlab_plotly' package and I was able to create an 'jupyterlab_plotly.Plotly object', but I couldn't figure out how to actually include/draw the graphics in the notebook. I wonder if someone could post a working example of drawing figures in jupyterlab with pyplot. (The example at the project's git site - https://github.com/gnestor/jupyterlab

R plotly hover label text alignment

删除回忆录丶 提交于 2019-12-08 18:17:45
问题 I'm adding custom hover text for scatterplot points in a plotly graph in R. It appears to be aligning the text left, center, or right depending on whether the text box is shown to the right, center, or the left of the plot points, respectively. I'd prefer if the text was always aligned left regardless of the positioning of the box. I've been able to style the font, e.g. setting the color and size, but haven't been able to change the text alignment. Here's an MRE. I've removed the legend so

How to remove duplicate legend entries w/ plotly subplots()

为君一笑 提交于 2019-12-08 16:38:05
问题 How can I remove the duplicates in my legend when using plotly's subplots()? Here is my MWE: library(plotly) library(ggplot2) library(tidyr) mpg %>% group_by(class) %>% do(p = plot_ly(., x = ~cyl, y = ~displ, color = ~trans, type = 'bar')) %>% subplot(nrows = 2, shareX = TRUE, titleX = TRUE) %>% layout(barmode = 'stack') 回答1: Another workaround using the tidyverse . The following steps are added to the original MWE: Convert the trans column to a factor. Use tidyr's complete to fill (non-NA)

Adding group bar charts as subplots in plotly

此生再无相见时 提交于 2019-12-08 16:15:12
问题 I want to create grouped ( barmode='group' ) bar chart subplots in plotly. Now the problem is that plotly doesn't create bar charts as traces. Instead grouped bar charts are created as lists of Bar traces. Because of this, I don't know how to create a figure that contains grouped bar charts as subplots (i.e. add a grouped bar chart using figure.append_trace() ). For example, how can I create subplots using bar charts created in this sample: import plotly.plotly as py import plotly.graph_objs