AndroidTV: How to add Dynamic DPI support? - android-tv

I am using Android S ATV platform having HDMI output.
As I hotplug HDMI to different TV's(HD, FHD, UHD), I see dynamic change in graphic FB size's based on HDMI output resolutions. But screen density always remains same. Due to this display output differs in size accross different resolutions.
With wm density command, density can be overridden. But that is not correct.
SurfaceFlinger always takes density value from prop lcd_density and if this value 0, then default is 213dpi.
SurfaceFlinger ignores DPI values reported by HWC.
Is dynamic density change is supported in AndroidTV S?
Note: Below values used for checking display size and density values.
wm size
wm density

Related

How to output always the same size (width/height) graph in R?

When I output the graph in R, the size (width and length) is always changing. So whenever I output graphs, I change the size by myself.
For example, I need a consistent graph size to insert into my document, but sometimes the default value of width and height is not the same when I try to export, particularly on different PC. How can I fix W:500. H:400 graph size all the time?
Many thanks!!
In order to get consistency, you should set the size of the graphics device yourself before plotting. For example, in Windows, you can use
windows(width=5.5, height=5, title="Controlled Size")
## NOW make your plot
to get a window that is always 5.5 inches wide by 5 inches high.
Other devices use minor variations for setting the size. You can check out other devices by looking at the help page help(Devices)
For example, bmp, jpeg, png and tiff allow you to set the number of pixels, not just the number of inches.

Zebra ZPL II Code to scale QR-Codes (^BQ)

I would like to print bigger QR-Codes to increase the scannable range. The magnification factor is already set to 10.
^XA
^FWN
^LH0,0
^FO50,40^A0R,75,75^FDTEST^FS
^FO150,45
^BQR,2,10,H,7^FDQA,TEST^FS
^PQ1
^XZ
ZPL result preview
Is there a way to scale the QR-Code, i would like to scale up the QR-Code by faktor 1.5
ZPL II Guide
You can use ^JMB to change the dots per millimeter. It will double the size, then you'll have to tweak it in ^BQ to get it where you want it. Also, I'm not sure ^BQR does anything, it looks like it only accepts ^BQN as a valid orientation.

RStudio windows size

In RStudio, we can adjust the size of 4 windows (or panels): text editor, console, environment/history, files/plots/packages/help/viewer.
I frequently export plots from RStudio and paste it in MS Word or save it as an image file. My concern is that the size of the plot is different every time because I often adjust the size of panels as I need.
Is there any way that I adjust the panels' sizes to the same sizes that I did before after I randomly adjust the panel sizes?
If I can specify the panel size by numbers, then I can do it, but RStudio does not provide such feature.
This code writes your plot in PNG format (good for web), with a specified width, height, and resolution. (In this case, 400 pixels / 72 pixels per inch = 5.56 inches across--every time). See here for more detail and other formats.
png(file="YOUR_PLOT",width=400,height=350,res=72)

increase png resolution when using saveHTML() {animation} in R

I am in need of a way to increase the resolution of the png files created by saveHTML().
Here is a dummy script of what I am trying to do where in reality plot() is a number of nested loops:
x<-y<-rep(1,10)
saveHTML( for (i in 1:10){
plot.new()
plot.window(xlim=c(0,10),ylim=c(0,10))
plot(x[i],y[i])
}
,ani.dev="png",img.name="test",htmlfile="test")
A few things I have tried:
1) increase the animation size using ani.options(ani.height,ani.width) but I only get a larger grainy image.
2) call png() device inside the saveHTML expression and set the resolution there, but ultimately I dont get any figures.
3) call a new windows() device for plotting and setting the window size, but again this does not increase the resolution.
The most straight forward work-around that I came across is to create hi-res pngs and animate using ffmpeg. But I am not ready to re-work my script just yet.
Has anyone found a way to increase png resolution inside the saveHTML() function?
Instead of passing ani.dev="png", you can pass ani.dev = function(...){png(res=75*grain,...)}, where grain is some number > 1. If you specify the options ani.height and/or ani.width and multiply these values by the same factor grain, then you effectively increase the pixel resolution of the output by this factor.
N.B.: the default resolution 75 above might be machine dependent, I did not see it documented.

Create flexible ggplot2 theme that 1) makes the legend and titles larger, 2) will look good irrespective of the final dimensions

I currently am one of the few R users in my company, which consists predominantly of stata users. One problem I've had with making plots using ggplot2 is that the default (theme_grey()) settings have much smaller axis font and a smaller legend than what is found in stata. Moreover, in presentations I find people have trouble reading the legend and titles from a distance.
I'm aware that ggplot2 has a theming system that allows for relative sizing. What I'd ideally like to do is to create a new default theme that I'd apply to all my plots that would make legends and axis titles larger. Importantly, however, very often the graphs I make have varying dimensions when output to pdf (e.g. 8 inch x 10 inch) or ( 10 inch x 13 inch). Since I'd like to apply this theme globally, I need it to produce good/easy to read output irrespective of the dimensions I specify when outputting to pdf.
I'd really appreciate any suggestions for how to do this/how to approach the problem using ggplot2's theming system.
Thanks!
The theme system can easily scale all the (themed) text, but not in a device sized aware way. The various theme sets, including theme_bw(), have an argument base_size which is the baseline size, in points, of fonts to use for the text. Some text is rendered at that size, and some is rendered at sizes relative to that (for example, axis labels and legend labels are rendered at 80% of the baseline size). So by specifying the base_size argument, you can scale all that text.
However, the base_size is in absolute points, not in a size which is relative to the device size. So the larger the device size, the smaller the text is relative to that.

Resources