Is there a way to replace the legend or axis without redrawing the whole plot? - r

Sometimes I will place a legend at a particular location on the plot, let's say topright, and then I see that it covers an important part of the plot. Is there a way I can switch it to topleft or some other place without having to run all the other commands first? Sometimes I have the same problem with the axes, I misspell a word and then I have to issue all the commands again.
I eventually place everything in an R script which means this becomes less of a problem, but sometimes I want to quickly test something in console. Please tell me I have overlooked a basic command that does this.

There is no such thing, but you're on the right track - a script is definitely the way to go. I would also recommend R Studio, a free R IDE, which gives you several displays, one for scripts, one for the console, one for your plots - it's great! It makes working with scripts as easy as interacting with the traditional R console.

As Gabriel told you, a script is the best way. However, the following link could help you:
Using Inkscape to Post-edit Labels in R Graphs

Related

Making a base R plot larger

I am not sure if this is possible, but I was wondering if I could expand the parameters of a base R plot. I am aware you can change the resolution/sizing of the graphs when you go to save them, but this isn't what I want to do. I was wondering if there is a command to stretch out the x/y-axis without increasing the range. I attached a picture of the graph I produced, which I feel is quite cramped and small. Below is also my code, which I don't think is an issue but wanted to attach anyways just to be safe. I'd appreciate any help, thank you so much!
plot(O2water, -1*O2rate,xlim=c(19,21.25))
abline(v=20.1)

Remove plot element without replotting everything else in R (Shiny)

This is not an specific question, but mostly a "looking for suggestions", since any kind of answer is welcome.
I built a huge website using pure shiny in R, but a really small thing is bothering me..
I'm plotting some elements over an image, let's say.. rectangles (could be anything), and interact with those elements using their position on the image. One of the actions is deleting some of those elements, but -as far as my understanding of R plotting system is- that can't be done, since an element plotted in R can't be removed, so my workaround is basically "plotting everything else" but the element i just deleted.
So, my question is, is there any way to "remove" an object in a plot without having to replot everything else (basically not making a new plot with everything but the deleted element)?
Thanks in advance!

How to draw a line or select something in using qvtkwidget?

I successfully made a program by using qvtkwidget, showing a few lines and points. And everything works perfectly. Next, I want to add an edit mode to my program, so that I can draw a line on it, or select some points or lines from it. Could anyone give me some guidelines for doing that? Do I need to use vtkRenderWindowInteractor? I tried to google but still can't find any clue.
you have to work with vtkinteraction, vtkobserver- callback, and vtkselection modules. and this example also useful http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/MoveAVertex HTH
And here is set of examples you may find relavent to your goal
http://www.vtk.org/Wiki/VTK/Examples/Cxx#User_Interaction

SVGAnnotation to create tool tips for each value in R heatmaps

I'd like to create a heat map in R that I want to use on a website. I stumbled upon the SVGAnnotation package which seems to be very nice to process SVG graphics in R to make them more interactive. First, I was planning to add tool tips for each cell in the heatmap - if the user hovers over the cell, the value of this cell should pop up. However, I am fighting with SVGAnnotation for more than 3 hours now, reading and trying things, and I can't get it to work.
I would appreciate any help on the SVGAnnotation tool tip function. But I would also very much appreciate alternatives to SVGAnnotation to add some activity to my R SVG heatmap.
So, what I have got so far looks like this:
library(SVGAnnotation)
data(mtcars)
cars <- as.matrix(mtcars)
map <- svgPlot(heatmap(cars))
addToolTips(map, ...) # problem
saveXML(map, "cars.svg")
My problem is the addToolTips function itself, I guess. Intuitively, I would simply insert the data matrix, i.e., cars, but this does not work and R gets stuck (it's calculating, but doesn't return anything, I waited 50 minutes)
EDIT:
After some more online research, I found a good example of what I want to achieve: http://online.wsj.com/article/SB125993225142676615.html#articleTabs=interactive
This heat map looks really great, and the interactive features (tool tips) work very well. I am wondering how they did that. To me, it looks like the graphic was done in R using the ggplot package.
I wrote a command line tool that can do exactly that if you are still interested to add tool tips to your heat map. It runs in Windows/Linux/MacOS terminals. All you need as input is the heat map as svg file and the data table/matrix that you used as input to create your heat map as csv or other text file.

Publishing a rgl interactive 3d plot to the web

I'm looking to see if something is possible, or some ideas if it isn't...
I've used the rgl package to generate an interactive 3d plot that you can rotate to look at the data from different angles.
I would like to be able to somehow publish this (or something similar) to the web to allow other to log on to the site and interact with the graph. Is this sort of thing possible?
I was playing around with the gWidgetsWWW package before which lets you use R as the back end of a website, but I'm not sure if this would be able to embed something as advanced as an RGL plot.
Ideally this would be on the web, but it doesn't have to - i.e. if it was possible to package the actual plot in some format and send it on to people.
Are there any ways to achieve this or can anyone think of a better approach? (Are there any non-R solutions I could look into that would give the same sort of output as rgl?)
Let me know if you need any more info. Thanks!
Looks like vrmlgen might help, but you probably need to have a VRML viewer application in your web browser. VRML was the new hotness about 15 years ago, but vrmlgen is only a few years old at most...
http://www.jstatsoft.org/v36/i08/paper
Some of the answers to this SO Q might help too:
3D visualization in browser

Resources