Use mouse to manually adjust geom_text() position? - r

Just wondering if there is any package/functionality to manually manipulate the positioning of text from geom_text()? I've been using ggrepel::geom_repel_text() for positioning without overlap, which is good for most cases, but when I have a ton of points all clustered in a tight space it would be much easier to just move them around without having to figure out the coordinates associated with each spot. Is this possible?

In case your problem relates to deciding which points to label, here's a Shiny app which allows for manual selection of points to label in a ggplot. It relies on ggrepel to space them, so if you want manual control, Marius makes a good suggestion.
https://github.com/AliciaSchep/gglabeller

Related

Is there a better way to create a button in AFrame?

I've seen this answer to how to create a 3-dimensional button in AFrame, but I was wondering if there was a better way to accomplish this. If there isn't, could somebody please clarify how the rotation/position attributes for the text work (e.g. where the axis of rotation is, where the position is based around relative to the cube, etc.). Thanks!
Depends on which implementation of text you are using. WebGL has no inherent concept of layout like the 2D web. There are upcoming implementations of text which will make it easier to layout and size.
For now, if a text implementation doesn't have any concept of layout, I would use the A-Frame Inspector (<ctrl> + <alt> + i) to manually place your text.
If you want automatic layout in relations to a mesh, you could also try computing the bounding box of the mesh and the text, and automatically centering/aligning the text.

Make a Graph Webpage

I want to make the whole webpage into a graph, like a blueprint (the colour scheming). And then i want to plot a graph in the same page. So should i use some code to make the grid or should i just make an image file and make it the background.
The grid should be preferably something like this : Graph, or with the proper coloring Blueprint Graph
If code is suggested, please give an overview of how to do so.
Thank You.
This sounds like something you could do with HTML5 Canvas, although maybe that's above and beyond what you're looking for. Here's a pretty good free course that has relevant examples.
Since you're going to be plotting points on the graph, your best bet is to create an element, such as a <div>, and give it a fixed width and height. Then apply a background image of the graph paper to that element. You'll need to use absolute positioning when plotting points, so it's key that the graph stays in place and doesn't get skewed based on differing viewports.
If you wanted the entire viewport to be a graph, you'll need to reference the upper-left corner when plotting points (start at 0,0) since users' browsers will have varying widths and heights.

Drawing graphs with purely HTML5

Can any one point me to any resources for making graphs in HTML5? Most of resources I have seen through Google use animated graphs, I just want a simple static graph in HTML5. One more thing, I am really very weak in graphs, so a simple, easy to understand solution would be very helpful. I will be using this XML file to display data in graphical format.
US Canada Mortality
Thanks in advance :-)
Check out the new canvas tag. It allows you to draw shapes including rectangles and circles using javascript. Canvas Tutorials
If you're looking for just a standard bar chart, though, you can use the div tag with a specified width, height, and background color. This method avoids the use of javascript.

CSS: On-mouse-over functionality from plot covered by a 'sheen' layer

I have a javascript plot on my page with "data point highlighter" functionality: when the mouse hovers over the point, you can see the coordinates popup. I also want to place a semi-transparent "sheen" image layer over the plot to make it look glossy. I can achieve this with the z-index, but the on-mouse-over functionality of the js plot stops working. Is there a way to have the sheen layer on top and still have the on-mouse-over of the layer below (the plot layer)? Many thanks...
I can't think of a way to do that easily, apart from splitting apart the plot image and the area that reacts to the mouseover, and placing the latter above the sheen - which may be bothersome to do.
If it's semi-transparent, though, would it be an option to do the whole thing the other way round? Placing the "sheen" below the plot, and making the plot semi-transparent?
This is not possible. Shame.
Actually, I believe it is possible, but it's a bit of a messy workaround, and, in essence, involves capturing mouse/cursor position x/y location and mapping that to the plot layer -- not the easiest or optimal task, let alone completely inefficient. I realize this is an older question, but thought I'd point this out for future users.
Update: Firefox has a CSS property geared toward this in the 3.6: http://demos.hacks.mozilla.org/openweb/pointer-events/

Label along the line in Flex LineChart

I'd like to put a label to each LineSeries on my Flex LineChart so it will be shown next to the line (along it). Any relatively easy way to archieve that?
Well what Mike is asking is quite reasonable, as for the colorblind people Legend might not work well, so they need a strong visual indication that, which line is representing which series.
Can't think of anything else though... :(
How is your question different from this example: LineChart and AreaChart controls example (scroll to the bottom)?
I think you'll find that what you are asking will clutter your chart.
Perhaps instead, you add a mouseover event handler to each legend item and when the event fires, highlight the series in one way or another.
When I did this, I simply faded all series except for the one selected.
You can use the CartesianDataCanvas to position your labels.
http://livedocs.adobe.com/flex/3/html/help.html?content=charts_eventsandeffects_13.html

Resources