plotly

Is there a way to reverse the order of the y axis in heatmap of plotly

不问归期 提交于 2019-12-22 11:33:52
问题 So I have hours = [x for x in range(7,18)] columns = [1, 2, 3, 4, 5] matrixDatos = [[0,1,0,1,0], [0,1,0,1,1], [2,3,2,3,2], [2,3,2,3,3], [4,5,4,5,4], [4,5,4,5,5], [6,7,6,7,6], [6,7,6,7,7], [8,9,8,9,8], [8,9,8,9,8] ] table = ff.create_table(matrixDatos) fig = ff.create_annotated_heatmap(matrixDatos, x=columns, y=hours, colorscale='Viridis') But it prints the heatmap with the y axis from 18 to 7 is there a way to print it from 7 to 18? 回答1: Hi I tried the code provided, I was getting an error

Change color of markers of a trace in plotly with plotly proxy without changing the marker size

笑着哭i 提交于 2019-12-22 10:26:57
问题 I'm trying to use plotlyproxy to change the color of a trace , which works, but the problem is, is that it also alters the size of my markers / legendmarkers . A long time ago I found out that there is (as far as my current research shows) still no way to separately set the size of legend markers to be different than the plot marker. A disaster if you want to plot 5000 points in a scatter plot if you ask me as you end up with either tiny legends or giant plot markers. So the question is an A

Plotly custom modebar icon change color and shape, and open link in a new window from R

北慕城南 提交于 2019-12-22 10:14:38
问题 I am using a custom modebar icon to open a link in a new window, and have some related problems Problem 1) Custom icon is not a square. If rescaled to fit in a square would be too small. How do you get it to display properly? To edit in the html that you get after knitting your rmarkdown is straightforward, by right clicking on your icon, and selecting inspect, you can change the width from 1em to 2em to get a wide rectangle. <svg viewBox="0 0 NaN" class="icon" height="1em" width="2em"> How

Customizing the order of legends in plotly

妖精的绣舞 提交于 2019-12-22 09:57:43
问题 I am trying to customize the order of legends while plotting stacked bar plots in plotly,python. data = [ go.Bar( y=df['sid'], # assign x as the dataframe column 'x' x=df['A'], orientation='h', name='A' ), go.Bar( y=df['sid'], x=df['B'], orientation='h', name='B' ), ] layout = go.Layout( barmode='stack', title=f'{measurement}', xaxis=dict( title='Count', dtick=0), yaxis=dict( tickfont=dict( size=10, ), dtick=1) ) fig = go.Figure(data=data, layout=layout) plot(fig, filename='plot.html') The

Adding hyperlinks to Shiny plots

纵饮孤独 提交于 2019-12-22 06:50:09
问题 I have made a Shiny app using different plotting solutions to render graphs from ggplot2 on Shiny (my favorite being plotly ). I like the fact that the user can interact with the graph: with plotly the user can zoom on the graph or click on points (on a scatterplot for exemple) and access their values. I would like to link each point on my scatterplot to a URL (without displaying it) and to allow the user to click on a dot, which would trigger the activation of the hyperlink opening a new

R plotly version 4.5.2 scatterplot legend bubble size settings

南楼画角 提交于 2019-12-22 06:49:58
问题 I am using plotly 4.5.2 in R. I have created a scatterplot which is sized on a variable, the issue is these sizes are also reflected in the legend which makes them hard to read. I want my graph to remain the same, with the only exception being the size of the bubbles in the legend. These bubbles can either be set to all be the same size or scaled to a smaller size. Importantly, the sizes in the graph must remain the same. Please find reproducible code here: library(plotly) data <- data.frame

Plotly R order legend entries

半腔热情 提交于 2019-12-22 06:36:29
问题 Is it possible to order the legend entries in R? If I e.g. specify a pie chart like this: plot_ly(df, labels = Product, values = Patients, type = "pie", marker = list(colors = Color), textfont=list(color = "white")) %>% layout(legend = list(x = 1, y = 0.5)) The legend gets sorted by which Product has the highest number of Patients. I would like the legend to be sorted in alphabetical order by Product. Is this possible? 回答1: Yes, it's possible. Chart options are here: https://plot.ly/r

R plotly - Plotting grouped lines

自作多情 提交于 2019-12-22 04:55:07
问题 I am migrating over from ggplot2 to plotly, in order to take advantage of the interactive features they offer. I do realize that the plotly library has a ggplotly function I can use to encapsulate native ggplot commands, but I wanted to learn how to plot similar graphs using native plotly commands. My problem is that I can't seem to make plotly draw grouped lines the way ggplot2 does. Base Data, using the default mpg data set from ggplot2 mpg %>% group_by(manufacturer, class) %>% summarise

How to create new line in Plot.ly JS title

泄露秘密 提交于 2019-12-22 04:14:06
问题 I am using the Plot.ly JS for graphs. The graphs are charting the answers given to certain questions in a survey. So, the title of the graph is the question itself which can get a little long. Right now, the title runs off the graph and is hidden as seen in the image below (can't embed images yet on Stack Overflow so it created a link to the image instead): This is the code being called where values and labels are variables defined elsewhere: var graph_data = [ { values: values, labels:

Adding a polygon to a scatter plotly while retaining the hover info

大城市里の小女人 提交于 2019-12-22 03:52:39
问题 I have 5 clusters of x,y data I'm plotting using R 's plotly . Here are the data: set.seed(1) df <- do.call(rbind,lapply(seq(1,20,4),function(i) data.frame(x=rnorm(50,mean=i,sd=1),y=rnorm(50,mean=i,sd=1),cluster=i))) Here's their plotly scatter plot: library(plotly) clusters.plot <- plot_ly(marker=list(size=10),type='scatter',mode="markers",x=~df$x,y=~df$y,color=~df$cluster,data=df) %>% hide_colorbar() %>% layout(xaxis=list(title="X",zeroline=F),yaxis=list(title="Y",zeroline=F)) Which gives: