I have a function that shows a plot consisting mainly a lot of text (a modified version of the wordcloud function from the wordcloud package). Resizing the window without resizing the text looks bad. I would like to create a custom hook for a function called whenever the plot window is resized.
How can I do this, programatically, in R, if it can be done at all?
This document talks about the display list and what happens when graphics are resized. I don't see a way to redo the calculations with base graphics, though there may be a hook that can be set. If you use grid graphics instead of base graphics then the linked document has some suggestions that may trigger the recalculations you want.
Related
I recently started using the stringr-package in RStudio. I really like the str_view_all function. Currently I'm working with a large dataset of strings and like to look at the matches. str_view_all works alright, but sadly I'm not able to scroll through the output (on the right). When extending the viewport for the output more lines are shown.
Is there a way to scroll through this output (I can't further extend the viewport at some point)?
There is no way to scroll through the output in RStudio's Viewer tab: https://github.com/tidyverse/stringr/issues/127
Try the "View in new window" shortcut on top of the Viewer, it allows you to see the full output in a web browser.
I tried to find in the documentation how to change the window title but without success. Is it possible to set the window title in any way? By default, my window are titled like so "RGL device 1 [Focus]".
How can I see previous tables that I generated in the viewer instead of only the most recent thing that I ran? For example if I've run several tables and changed one or two things and I wanted to be able to compare them side by side, how do I see them both? I'm thinking about how I can scroll through an SPSS output file.
I'm not sure if this is a code thing or a settings thing. Opening a new window doesn't seem to do anything. Refreshing the viewer doesn't seem to change anything.
I can put things in the viewer no problem using view() or expss_output_viewer or out="viewer".
I can only seem to get it to display the most recent table I ran.
Click the arrows in the upper left of the viewer pane to see previously plotted tables.
Image of viewer pane with arrows highlighted
Using flextable
flextable(mtcars)
Using expss
expss_output_viewer()
as.etable(mtcars)
I'm trying to write an R function that allows a user to select a rectangle within a displayed image. The selection could then be used for zooming, copying or other manipulation. The gwidgets package appears to provide this functionality for many of its widgets, but not for images. Does anyone have a suggestion for where to turn next?
Thanks!
I would like to change the Window Manager icon (in the top left corner of my gwindow()), using gWidgets in R. I want to add my own picture rather than using the R logo in the corner. I have loaded the picture into R, just by calling gimage("imagename.jpg"). I can manage to open this image up in a window, by calling gimage("imagename.jpg", cont=gwindow(cont=T)), but not as the icon.
I feel like this should be something really simple to do. I have googled how to do it, but can't find an answer. I found that, using RGtk2, you just add the argument icon=imagename when creating the window.
I tried this with gWidgets as well by calling gwindow(icon=gimage("imagename.jpg"), cont=T), however this didn't do anything different than just calling gwindow without the extra argument.
This seems like it should be really simple, but I can't find an answer anywhere. Any help would be greatly appreciated.
Thanks.
There is nothing in gWidgets here to help, but if you load RGtk2, then the setIcon method of the GtkWindow can help you, but you need to get it first:
Try something like:
w <- gwindow()
require(RGtk2)
img <- gdkPixbufNewFromFile("your_icon.png")
getToolkitWidget(w)$setIcon(img$retval)