The documentation for Ploty's R graphing library.
plotly / plotly.r-docs Goto Github PK
View Code? Open in Web Editor NEWThe documentation for Ploty's R graphing library.
The documentation for Ploty's R graphing library.
featureidkey
for Mapbox Choropleth.Hi,
The examples charts on the R plotly site no longer display (see line and scatter for example).
In the console it has the error TypeError: Plotly.plot is not a function. (In 'Plotly.plot(graphDiv, x)', 'Plotly.plot' is undefined)
Not sure if this is most or all charts, but the few pages I clicked through all have this issue.
when several plots are combined as subplot, plotly R contour plots use different colors for the contour lines (since an update some months ago). Sadly, after 5 different colors there seem to be no more available and the subplot cannot be created. How can the contour line colors be set to be the same for different subplots?
My example shows this issue when the "grouping variable" is set to "block": https://sae-interactive-data.ethz.ch/sae-eschikon-live/
Hello,
I have been testing your example (https://plotly.com/r/network-graphs/) and everything works perfectly.
However it would be nice to add some curvature to the lines between nodes (similar to other edge bundling plots)
I have a big dataset (+700 nodes) and some angle to curve the lines would make it easy to visualize the plot.
But I'm not sure how can be done with plotly?
Best regards,
Can't push plot from R using plot_ly::api_create()
. Get the following error:
Error: lexical error: invalid char in json text.
<html><head> <meta http-equiv="
(right here) ------^
In addition, warnings()
produces this console output:
'/Users/robwiederstein/.plotly/.credentials': No such file or directory
These are appearing in spite of me setting environment variables for username and api key. More odd, is that plotly accepted the plot once--not sure why.
@TristanGa @sacul-git figured out how to make this work... @Mahdis-z can you sync up with them and get an R version of https://plot.ly/python/mapbox-county-choropleth/ up please? Plotly.R already supports plotly.js 1.49+ today so this isn't blocked.
This kind of example:
p <- plot_ly(x = ~s, y = ~s) %>% layout(xaxis = a, yaxis = a)
p
should be rewritten as
fig <- plot_ly(x = ~s, y = ~s)
fig <- fig %>% layout(xaxis = a, yaxis = a)
fig
@jdamiba can you try to get this CI job running again please? Something changed upstream I think. I messed around with it a bit but wasn’t able to make progress... reach out to @HammadTheOne or @sacul-git if you get stuck?
Basically this means porting over from the Python docs:
There is no information whatsoever on how to format data to use in the plotly. The data from the example (volcano) has no description. Usual format are meshgrids with a z coordinates, or triplets x,y,z.
The documentation provides no clear way to transform typical acquisition data into the necessary format.
See the issue described here: https://stackoverflow.com/questions/40256793/rotate-axes-titles-with-ggplotly
Article under address ( https://plotly.com/r/static-image-export/ ) needs to be updated to reflect the deprecation of orca:
library(plotly)
if (!require("processx")) install.packages("processx")
fig <- plot_ly(z = ~volcano) %>% add_surface()
orca(fig, "surface-plot.svg")
Warning message:
'orca' is deprecated.
Use 'kaleido' instead.
See help("Deprecated")
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
other attached packages:
[1] reticulate_1.22 plotly_4.10.0 processx_3.5.2
Hi,
I am making 3D plots and coloring the dots based on which cluster they belong to.
the issue only seems to arise when the size is specified.
It's difficult to illustrate with pictures since it is in 3D, but basically dots that are behind other dots in 3D, overlay dots in front of them.
#umap.3d is character vector of umap colnames in data
library(plotly)
p <-plot_ly(
x = data[, umap.3d[1]],
y = data[, umap.3d[2]],
z = data[, umap.3d[3]],
type="scatter3d",
mode = "markers",
size = 1,
color = as.factor(data$kmeans_clustering)) %>%
layout(
title = "Clusters"
);p
Pay attention to the pink and orange cluster down to the right. Here they are on top of all other dots.
After changing the angle you can see that they actually belong to another population far in the back.
Now without any size parameter.
p <-plot_ly(
x = data[, umap.3d[1]],
y = data[, umap.3d[2]],
z = data[, umap.3d[3]],
type="scatter3d",
mode = "markers",
color = as.factor(data$kmeans_clustering)) %>%
layout(
title = "pheno_clusters"
);p
We should move https://plot.ly/ggplot2/getting-started/ and https://plot.ly/ggplot2/user-guide/ off of Chart Studio embeds and move them into this repo
This page says setting graph size: https://github.com/plotly/plotly.r-docs/blob/master/ggplot2/2021-08-04-setting-graph-size.Rmd
but it has nothing to do with setting the graph size. Setting graph size is something like ggplotly(p,height=300,width=300)
, but I cannot find the documentation for this.
When I set a custom height as specified above in a quarto document, sometimes the plot doesn't show. It's just blank.
Hi! I run the network graph example, but it did not work for me. I fixed it by changing the code in the "create edges" section as
edge_shapes <- list()
for(i in 1:Ne) {
v0 <- es[i,]$V1
v1 <- es[i,]$V2
v0_index <- which(V(G)$name == v0)
v1_index <- which(V(G)$name == v1)
edge_shape = list(
type = "line",
line = list(color = "#030303", width = 0.3),
x0 = Xn[v0_index],
y0 = Yn[v0_index],
x1 = Xn[v1_index],
y1 = Yn[v1_index]
)
edge_shapes[[i]] <- edge_shape
}
Although the documentation at https://plotly.com/ggplot2/legend/ says that the position of the legend can be moved, several of the examples show no response to changes in underlying code.
I've experience similar issues where changes made in ggplot do not propagate through the ggplotly function.
The information contained in https://plotly.com/r/static-image-export/ is outdated. It recommends the usage of the deprecated orca package.
In this explanation for how to implement geom_boxplot with plotly (https://plotly.com/ggplot2/box-plots/#outliers) there is a mistake in the function used.
Currently the code example reads like this:
library(plotly)
set.seed(123)
df <- diamonds[sample(1:nrow(diamonds), size = 1000),]
p <- ggplot(df, aes(cut, price, fill = cut)) +
geom_boxplot(outlier.shape = NA) +
ggtitle("Ignore outliers in ggplot2")
# Need to modify the plotly object and make outlier points have opacity equal to 0
fig <- plotly_build(p)
fig$data <- lapply(fig$data, FUN = function(x){
x$marker = list(opacity = 0)
return(x)
})
fig
it should be
library(plotly)
set.seed(123)
df <- diamonds[sample(1:nrow(diamonds), size = 1000),]
p <- ggplot(df, aes(cut, price, fill = cut)) +
geom_boxplot(outlier.shape = NA) +
ggtitle("Ignore outliers in ggplot2")
# Need to modify the plotly object and make outlier points have opacity equal to 0
fig <- plotly_build(p)
fig$x$data <- lapply(fig$x$data, FUN = function(x){
x$marker = list(opacity = 0)
return(x)
})
fig
Note the difference fig$x$data
instead of fig$data
otherwise this won't remove the outliers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.