plotly

Specifying the colors in a Plotly Heatmap

僤鯓⒐⒋嵵緔 提交于 2020-01-21 10:30:36
问题 I currently have a Plotly heatmap with categorical axes. The heat map plots the individuals of a graph against themselves, with each pair of individuals having a integer value (the z-value, which is what is plotted on the heat map) assigned to that pair (it's a measure of how fair apart the pair our). Right now, the colors on the heat map are being automatically assigned. Unfortunately, I can't quite figure out how to specify the color scheme for such a heat map. Is it possible to specify the

ggplotly not displaying geom_line correctly

落爺英雄遲暮 提交于 2020-01-20 05:49:05
问题 I am trying to use ggplotly to add interactivity to my ggplot chart. I have tried running this in both RStudio and from the command line, with the same results. Data: library(plotly) df1 <- as.data.frame(list('x'=1:100,'y'=1:100,'lw'=abs(rnorm(100)))) b <- ggplot(data=df1, aes(x=x,y=y)) + geom_line(size=df1$lw) If I display b normally, i.e. > b , I get a correct plot However, if I then enter ggplotly() , I get the plot below: Using my real data, the results are even worse. Below is a plot() ,

Embedding a Plotly chart in a Django template

戏子无情 提交于 2020-01-19 20:29:09
问题 I am trying to embed a plotly pie chart in a Django html template. This works fine when the chart is produced in 'online mode' (i.e. the html snippet is stored on the plotly server) but not in 'offline mode' (i.e. when the html is stored locally). In the latter case, the chart does not appear. I want to be able to store the html on my local server and embed the plots from there. Here is the bit that works: import plotly.plotly as py import plotly.graph_objs as go labels = [1,2,3,4] values =

Embedding a Plotly chart in a Django template

倖福魔咒の 提交于 2020-01-19 20:28:34
问题 I am trying to embed a plotly pie chart in a Django html template. This works fine when the chart is produced in 'online mode' (i.e. the html snippet is stored on the plotly server) but not in 'offline mode' (i.e. when the html is stored locally). In the latter case, the chart does not appear. I want to be able to store the html on my local server and embed the plots from there. Here is the bit that works: import plotly.plotly as py import plotly.graph_objs as go labels = [1,2,3,4] values =

Show observations that are outliers in plot_ly

自古美人都是妖i 提交于 2020-01-17 03:17:05
问题 I am plotting jitter boxplots through plotly in R. Plotly boxplots allow analyzing interactively the quartiles and the values of outliers. (Examples here: https://plot.ly/r/box-plots/) I would like to see the name of observations that are outliers, so I can analyze them later. However, it seems that boxplots don't have the option of watching to which observation they belong to, in contrast to scatter boxplots, where one can see it through 'text' option. Before implementing other approaches,

Modifying individual tick labels in R Plotly

╄→尐↘猪︶ㄣ 提交于 2020-01-16 04:28:10
问题 Suppose I have some code such as, library(plotly) Animals <- c("giraffes", "orangutans", "monkeys") SF_Zoo <- c(20, 14, 23) LA_Zoo <- c(12, 18, 29) data <- data.frame(Animals, SF_Zoo, LA_Zoo) p <- plot_ly(data, x=~Animals, y=~SF_Zoo, type='bar', name='SF Zoo') %>% add_trace(y=~LA_Zoo, name='LA Zoo') %>% layout(yaxis=list(title='Count'), barmode='stack') I'm trying to figure out how I color the three x-axis labels (giraffes, monkeys, orangutans) different colors, I've been trying to do this by

Setting a different font color for specific x axis ticks

╄→гoц情女王★ 提交于 2020-01-16 04:20:11
问题 I'm creating a frequency plot with NA values also plotted. I'm trying to color the N/A values differently in x-axis tick. I know how to do this in matplotlib but can't seem to figure out how to do it using plotly. I tried updating the tickcolors and tickfonts using a list of values but it just expects a single value for both of these attributes. Please see the code below # Doesn't work - plotly expects a single value for tickcolor fig.update_xaxes( tickangle = -60, tickcolor = ['black',

Grouping elements in legend fails with ggplotly

别等时光非礼了梦想. 提交于 2020-01-15 10:07:05
问题 In the following example, grouping ggplot-elements appears to work, until I convert the plot with plotly::ggplotly() . I'm struggling to understand if this is because I'm doing something wrong, or if this is another plotly-bug. Reproducible Example # example data df <- structure(list(a = structure(list(est_score = c(0.208979731611907,0.328919041901827, 0.396166493743658), upper_bound = c(0.992965325427929,1.11290463571785, 1.18015208755968), lower_bound = c(-0.575005862204114,-0

How can I grab the row of data from a ggplotly in shiny

亡梦爱人 提交于 2020-01-15 06:56:33
问题 Code Below. I'm trying to use the plotly_click event to figure out what data is being selected. However, I can't figure out how to do it. The data provided by plotly_click is very minimal and doesn't include the grouping or groups at all. I don't have any JS experience, but I know there must be a way! My goal is to be able to select a data point and be able to grab the row it corresponds to in a data.frame d1 d1=structure(list(Topic = c("compensation", "manager", "benefits", "family",

Update plot from interactive table in html

依然范特西╮ 提交于 2020-01-15 06:38:08
问题 What I would like to be able to do is to update the plot based on the output from the (DT-)table after filtering in the html . For example - here is a screenshot of the table filtered for maz in the html: I would like the scatter plot to update to only show the values shown in the filtered table. Is this possible? I know I could achieve something like this using a shiny web app, but is it possible to embed some shiny code into the html to achieve this? (I have very limited experience using