I plot 3D scenes from Julia using PlotlyJS into an Electron window. When I change the viewing parameters with the mouse, zooming, panning, or rotating, how do I get the eye, center, and the up vector from the plot? Even when I save the plot into a JSON file, the camera parameters are those of the original plot.
I found that setting the options of the plot as
options=Dict(:showLink => true)
equips the plot with a link to a web site where the plot can be manipulated. The camera settings can be read off there. See, for instance, https://github.com/PetrKryslUCSD/FinEtoolsFlexBeams.jl/blob/master/examples/graphics/edit_plot.jl
Related
I would like to export a vector version .pdf of a plot
but I would like the exported version to look exactly like what is shown in the Plot zoom window.
My quibble is that the vector plot produced using the Rstudio built-in export feature (image on left), is subtly different from what is shown in the Plot zoom window (image on right).
for example in the image below the colors are tad different, and the scattered points in the exported version don't possess that fine stroke that is seen in the Plot Zoom window.
Is there anyway I could get the exact vector version of the Plot Zoom window?
I want to plot the recorded path of an object such as a plane or drone in 3d space using R. The plotted path should be represented by a flat “ribbon” whose orientation perpendicular to the direction of travel changes to reflect the roll of the object. In other words, I want to be able to visualize the path and orientation of the object in one "ribbon" as it banks in turns.
As far as as I can tell, a traditional ribbon plot in R won't allow you to change the orientation in a third dimension.
Matlab and Python have functionality for creating quiver plots where arrows may be placed to indicate the xyz orientation of the object at a given point in time along the path. I cannot find any R packages with similar functionality.
I have played with Plot3D, Plotrgl, Plot3Drgl and cannot find a package that has this capability.
Q1: Are there any packages in R that would support this type of plot?
Q2: If there isn't, how can I go about creating this type of plot R?
Below are examples in Python and Matlab for the 3D quiver type plots, as well as an image demonstrating the ribbon concept I am imagining.
https://medium.com/analytics-vidhya/exploring-data-acquisition-and-trajectory-tracking-with-android-devices-and-python-9fdef38f25ee
Example of 3D quiver plot in python
https://github.com/xioTechnologies/Gait-Tracking-With-x-IMU
Example of 3D quiver plot in matlab
This is an example of what the "ribbon" would look like
Thanks for any help!
I have a 3D plot in plotly for R that I want to put into a presentation. Is there a way I can animate the 3D space rotating in some way as a .gif or other from R?
I understand how to make the plot, how to rotate it on my own, and how to publish it on RPubs, but can't figure out how to save it out. Example below.
# build dataframe
df <- data.frame(replicate(3,sample(0:25,50,rep=TRUE)))
# 3d scatterplot
p1 <- plot_ly(df, x = ~X1, y = ~X2, z = ~X3,
type = "scatter3d",
mode = "markers")
p1
Now we have a cool 3D scatterplot in viewer that user can rotate with mouse drags, but I want to save it out to rotate on its own. There is also a 'save to png' button in the viewer, but when I click it, a text box pops up that says "there was a problem saving your image." I'm thinking some kind of loop that saves images out at different viewer angles, then stitches them together? Any ideas appreciated.
I also tried using the orca() command and received the following error:
orca(p1,file="3dplot.png")
Error: The orca command-line utility is required for this functionality.
Not sure what it means.
In the Viewer tab, if you click Export and Save as Web Page... you might get what you want. Remember to use the .html extention
Neither of both options Save to png or orca() are going to work because the save a snapshot of the current angle so you lose the dynamic part.
Best!
So, when we do something like: 'splot sin(x)*cos(y)' and we can rotate the ouput.
But if we do:
'set terminal png'
'set output "a.png"'
'splot sin(x)*cos(y)'
Then, is it possible to rotate the "a.png" file?
Thanks.
No, you cannot rotate a png file as if you were in interactive mode.
To display a 3D data set on a flat screen, any program must calculate a 2D projection in order to show the data. This projection is then rasterized, i.e. converted to pixels in order to be saved as png.
Already with the projection you loose all 3D information which would be necessary to perform any kind of 3D manipulation, besides that png looses even more information by the rasterization.
Gnuplot doesn't support any special data format which would be necessary to manipulate the 3D view later with a viewer.
I am using Core Plot in my iPad application to plot some data points on a scatter plot. I would like the axes to pan around with the data until one of the axes gets near the edge of the graph. Then I would like that axis to be constrained so that it does not go beyond the edge of the graph. I know that I can use CPTConstraints to fix the axes, but I don't want them to always be fixed. I simply want them to be fixed when they come near the edge of the graph so that they remain visible. I've attached some screenshots of my application to show you what I mean.
Use a plot space delegate to monitor changes to the plot space. Implement the -plotSpace:willChangePlotRangeTo:forCoordinate: delegate method and use the new plot range to decide whether to set the orthogonalCoordinate or constraints to position the axis.