plotly

Is there a way to hide Trace Names in Plotly (specifically R)?

橙三吉。 提交于 2019-12-02 07:24:26
问题 I've been wracking my brain over how to get rid of the trace name with plotly and can't seem to find anything. It seems adding the trace name is a unique feature of plotly boxplots. I could just name it " " but I need the original trace name so that I can reference it when overlaying a marker. I've simplified the code as much as possible to the root issue. Is there a way to hide the trace name? housing = read.table("http://archive.ics.uci.edu/ml/machine-learning-databases/housing/housing.data

Plotly's fillcolor defaults to half-transparency, want no-transparency

Deadly 提交于 2019-12-02 07:01:44
问题 I am trying to build a map in R using plotly. I will share the code required to build the dataframe in a reply to this post. Here is the code I am using to plot the chart: florida %>% group_by(group) %>% plot_ly(x = ~long, y = ~lat, color = ~color_vals, colors = 'Blues') %>% add_polygons(line = list(width = 2), # fillcolor = 'WHAT GOES HERE', opacity = 1, showlegend = FALSE) and here is the output I am getting: My issue is simple to understand, but I cannot find a way to fix this. I'd like

Plotly xaxis in weekday name

耗尽温柔 提交于 2019-12-02 06:46:39
I’ve looked into the documentation but they didn’t seem to mention it. https://plot.ly/python/axes/ How can I change the label on x axis to show “Mon 20-7”, “Tue 21-7”, etc. The 'date' used for xaxis is in the format "20-7-2018 11:00:00am", etc. I use the following Python Plotly script: trace0=go.Scatter(x=df_pre.index,y=df_pre['Total'],line=dict(color=('rgb(16,25,109)'),width=1),name='Period_1') trace1=go.Scatter(x=df_post.index,y=df_post['Total'],line=dict(color=('rgb(77,221,26)'),width=2),name='Period_2') data=[trace0,trace1] layout=dict(title='Total',width=960,height=768, yaxis=dict(title=

Strange formatting of legend in ggplotly in R

微笑、不失礼 提交于 2019-12-02 05:40:31
I'm trying to turn a ggplot into a plotly. The ggplot renders fine, but when I put it through ggplotly, suddenly the legend adds parenthesis and ",1" after the label. Here's a sample fake data: sorted1<-data.frame(CommDate=c(as.Date("2017-09-12"), as.Date("2017-10-15")), CommName=c("Foo", "Bar"), PubB4=c(2,3)) And here's the code I'm trying to run on it: ggplotly(ggplot(sorted1, aes(x=as.Date(CommDate), y=PubB4))+ geom_smooth(level=0.0, aes(colour="Moving average"), se=FALSE)+ geom_point(aes(fill=CommName), size=4)+ expand_limits(y=c(0,4.5))+ geom_line(mapping=aes(y=4),colour="orangered3",size

trace order plotly R

倾然丶 夕夏残阳落幕 提交于 2019-12-02 05:36:52
I am trying to figure out how to control the order of the traces plotted in plotly, i.e. how to bring traces to the front and to the back. Here there is a simple piece of code that plots two traces. How can I decide the order? library(plotly) airquality_sept <- airquality[which(airquality$Month == 9),] airquality_sept$Date <- as.Date(paste(airquality_sept$Month, airquality_sept$Day, 1973, sep = "."), format = "%m.%d.%Y") plot_ly(airquality_sept) %>% add_trace(x = ~Date, y = ~Wind, type = 'bar', name = 'Wind', marker = list(color = '#C9EFF9') ) %>% add_trace(x = ~Date, y = ~Temp, type =

Plotly background images

对着背影说爱祢 提交于 2019-12-02 05:32:22
问题 I'm trying to get a background image on my graph using plotly. I can't seem to get ANY image to display without using one of the images.plot.ly links. I tried web URLs and local images in the same folder as the project. This is what is showing up when I used the image URL from their tutorial: https://plot.ly/python/images/ This is the only time I can get anything to show up. Any other link just produces nothing on the graph. Any tips? I have searched high and low for this. layout = dict(title

Arranging bars of a bar plot with “null” in Descending order in R

可紊 提交于 2019-12-02 05:26:16
问题 I want to create a bar plot with Descending bars, In the plot below, due to NA being present at 2nd spot in "a1" vector, it is pushed at the last when the plot is created. However, I want the NA bar to be present at the 2nd spot only, kindly help me here as I want to achieve this without modifying my data. library(ggplot2) library(plotly) a1 = c("A",NA,"B","C","D","F") b1 = c(165,154,134,110,94,78) a12 = data.frame(a1,b1,stringsAsFactors = FALSE) pp1 <<- ggplot(a12 , aes(x = reorder(a1,-b1),

Adding additional text to the hovertext label

最后都变了- 提交于 2019-12-02 04:44:54
I've searched for some time now and I can't seem to find a related question. There are similar questions, but nothing that gets to the heart of what I am trying to do with the code I have. I am trying to add additional text to the hovertext in plotly. Here is my code so far: import pandas as pd import numpy as np from plotly.offline import * init_notebook_mode(connected=True) graph1 = merged.groupby(['study_arm', 'visit_label'])['mjsn'].mean().unstack('study_arm') graph1.iplot(mode='lines+markers', symbol=['diamond-open', 'square-open', 'circle-dot', 'hexagon-open'], size=8, colorscale =

Set major tick labels to be displayed as scientific notation in a Plotly plot in R

别来无恙 提交于 2019-12-02 04:05:19
I'm trying to get plotly to put values in scientific notation regardless of their size, i.e. 100 should be 1E02 in the ticks, but it keeps showing numbers below 10.000 as normal annotation. Setting the format is done through exponentformat = "E" "but it only affects larger numbers. Here is an example code of how I write it: f2 <- list(family = "Old Standard TT, serif", size = 14, color = "black") ax <- list(showticklabels = TRUE, tickfont = f2, showgrid=F, zeroline=T, showline=T, nticks = 4, exponentformat = "E") ay <- list(nticks = 4, showticklabels = TRUE, tickfont = f2, showgrid=F, zeroline

Mysterious javascript bug that is depending on what plot object names are used in R shiny app

给你一囗甜甜゛ 提交于 2019-12-02 03:56:10
In the app below there is some weird mystery going on: Why can I not use certain names for my plots? The app was build as a dummy app to change the color of traces in plots. 1 button affects trace x in 2 plots, and there is one button for each trace. The button names contain the name of both plots, and the trace nr they target. When the plots are named plot1, plot2, plot3, plot4, it all works. but the actual program it is intended for uses different plot names. Changing all instances of plot1 into 'FP1plot' in the code works, changing plot3 into 'FP2plot' still works, but most names used to