plotly

Embedding plotly output in R markdown

£可爱£侵袭症+ 提交于 2020-01-10 20:03:52
问题 There is a blog entry which describes embedding from the plotly API for R into R markdown. I just used the code to create the iframe for an html document When I have the prieview in R studio there is no error message and the iframe is created in the html document. However, it is just empty. Apparently it does not load the content somehow. I did not create the plot in the R API beforehand (but that should not matter as this is just embedding a picture into html) isn't it? My code in r markdown

plotly create a vertical line to show average

喜欢而已 提交于 2020-01-07 03:16:29
问题 So i am attempting create a horizontal bar chart that has a horizontal line showing average. So far i have attempted the following: First added my barChart series (it comes from the following array): "series": [ { "value": 100, "label": "F1" }, { "value": 25, "label": "F2" }, { "value": 30, "label": "Jedi Jeremiah 555" }, { "value": 40, "label": "F4" }, { "value": 55, "label": "F5" }, { "value": 60, "label": "F6" }, { "value": 71, "label": "F7" }, { "value": 15, "label": "F8" }, { "value": 88

Plotly R converts numeric factor levels to numeric values [duplicate]

可紊 提交于 2020-01-07 00:48:27
问题 This question already has an answer here : Plotly R: Cant get points to plot when two values present per x factor level (1 answer) Closed 3 years ago . I have a basic data frame like this, and I am trying to plot x vs. y in plotly. It for some reason converts my x values to numeric (continuous scale) and plots instead of keeping them as factors. Any idea why it would do that and what I can do to make it behave differently (correctly)? df <- data.frame(x = c(1, 2, 4, 8, 16, 32), y = 1:6) df$x

Dropdown menu to select x, y and color (plotly)

人盡茶涼 提交于 2020-01-06 23:00:50
问题 I am trying to create a plotly graph with selectable x , y and color variables, based in part on this previous question. The x and y variable selection appears to work, however when new x and y variables are selected, the point color is lost. Further, I have tried to use a similar strategy to select the point colour, but unfortunately this does not seem to work. Another option would be to use the set visible strategy in the previously linked question. Example: library(plotly) library

R plotly: How to keep width parameter of ggplot2 geom_bar() when using ggplotly()

旧街凉风 提交于 2020-01-06 19:35:34
问题 For some reason, when converting in R a ggplot2 bar chart ( geom_bar ) into an interactive plot using plotly 's ggplotly function, ggplotly "forces" the bars to stick together, even if the width parameter is specified: library(plotly) library(ggplot2) DF <- read.table(text="Rank F1 F2 F3 1 500 250 50 2 400 100 30 3 300 155 100 4 200 90 10", header=TRUE) library(reshape2) DF1 <- melt(DF, id.var="Rank") p <- ggplot(DF1, aes(x = Rank, y = value, fill = variable)) + geom_bar(stat = "identity")

How to remove duplicate values in specific column without removing related row

馋奶兔 提交于 2020-01-06 14:25:17
问题 Want to remove duplicate values in specific column without deleting the rows related with duplicate column values as below example: Input ----- Date Market Quantity 4/2/2018 Indonesia 1000 4/2/2018 Australia 500 4/2/2018 India 300 4/2/2018 USA 500 4/2/2018 Germany 200 5/2/2018 India 400 5/2/2018 Japan 400 5/2/2018 Russia 457 6/2/2018 Austria 260 6/2/2018 Swiss 700 6/2/2018 USA 1200 6/2/2018 Indonesia 400 output ------ Date Market Quantity 4/2/2018 Indonesia 1000 Australia 500 India 300 USA

Change Marker Shapes in Plotly .js

一世执手 提交于 2020-01-06 09:28:09
问题 Im looking for a little assistance in changing the marker shapes in the plotly.js libary. What I am looking to do is change the first Marker and last marker for each group to a vertical line, and the middle one to a diamond. I have followed this reference link from plotly but can not seem to get it to work. Here is my JS that im using. var subject = ["Title 1","Title 1","Title 1","Title 2","Title 2","Title 2"]; var score = [40,50,60,20,40,60]; var data = [{ type: 'scatter', x: score, y:

How to subplot pie chart in plotly?

倾然丶 夕夏残阳落幕 提交于 2020-01-06 07:02:30
问题 How can I subplot 'pie1' in 'fig', so it be located at 'the first' position. this is how I am doing it but it doesn't work out import pandas as pd import numpy as np import seaborn as sns import plotly.offline as pyp import plotly.graph_objs as go from plotly import tools import plotly.plotly as py from plotly.offline import iplot,init_notebook_mode from IPython.core.display import HTML import plotly.io df1=pd.read_excel('file.xlsx',sheet_name='sheet1',index=False) con_pivot=pd.pivot_table

How to subplot pie chart in plotly?

北战南征 提交于 2020-01-06 07:01:12
问题 How can I subplot 'pie1' in 'fig', so it be located at 'the first' position. this is how I am doing it but it doesn't work out import pandas as pd import numpy as np import seaborn as sns import plotly.offline as pyp import plotly.graph_objs as go from plotly import tools import plotly.plotly as py from plotly.offline import iplot,init_notebook_mode from IPython.core.display import HTML import plotly.io df1=pd.read_excel('file.xlsx',sheet_name='sheet1',index=False) con_pivot=pd.pivot_table

How to plot 3D histogram of HSV and CIELAB values?

南笙酒味 提交于 2020-01-06 05:43:09
问题 I want to code a 3D histogram to develop a clustering algorithm in CIELAB space. I started with the 3D histogram in RGB space, which I found through this thread, and expanded to HSV as a springboard to CIELAB. I checked that the labels and values work for RGB images. I got most of the way there but a few things are off for HSV. Here is my refactored version of the code: # Histogram and plotly code from # http://reynoldsalexander.com/3dhistplots.html # and non-notebook plotting from # https:/