graphics

GADM-Maps cross-country comparison graphics

浪尽此生 提交于 2019-12-18 04:09:17
问题 Maybe due to the fact I'm relatively new to R, I have problems using the gadm-Mapfiles on http://www.gadm.org/. I try to draw a map with several countries and compare them to each other (using different colors). This is what I do library('sp') ## load(url('http://biogeo.ucdavis.edu/data/gadm2/R/ARG_adm0.RData')) # loads an Object "gadm" with shape of Argentinia arg <- gadm # is there a more convenient way to do this in one line? load(url('http://biogeo.ucdavis.edu/data/gadm2/R/CHL_adm0.RData'

GADM-Maps cross-country comparison graphics

淺唱寂寞╮ 提交于 2019-12-18 04:09:13
问题 Maybe due to the fact I'm relatively new to R, I have problems using the gadm-Mapfiles on http://www.gadm.org/. I try to draw a map with several countries and compare them to each other (using different colors). This is what I do library('sp') ## load(url('http://biogeo.ucdavis.edu/data/gadm2/R/ARG_adm0.RData')) # loads an Object "gadm" with shape of Argentinia arg <- gadm # is there a more convenient way to do this in one line? load(url('http://biogeo.ucdavis.edu/data/gadm2/R/CHL_adm0.RData'

Create an image from a non-visible AWT Component?

纵饮孤独 提交于 2019-12-18 03:55:14
问题 I'm trying to create an image (screen-shot) of a non-visible AWT component. I can't use the Robot classes' screen capture functionality because the component is not visible on the screen. Trying to use the following code: BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraphics(); component.paintAll(g); Works sometimes, but does not work if the component contains things such as a text box or button, or some sort of OpenGL / 3D

Add image (png file) to header of pdf file created with R

谁说我不能喝 提交于 2019-12-18 03:41:29
问题 I am trying to add an .png image (logo) to the header of my pdf report of graphs created with ggplot and printed to pdf. I found the following example how to add a image to a ggplot plot. But, I am looking to add the .png image to he header of the pdf which is outside the ggplot area. #------------------------------------------------------------------------------- # Example png file #------------------------------------------------------------------------------- library(reshape2) library(png)

Add image (png file) to header of pdf file created with R

淺唱寂寞╮ 提交于 2019-12-18 03:41:14
问题 I am trying to add an .png image (logo) to the header of my pdf report of graphs created with ggplot and printed to pdf. I found the following example how to add a image to a ggplot plot. But, I am looking to add the .png image to he header of the pdf which is outside the ggplot area. #------------------------------------------------------------------------------- # Example png file #------------------------------------------------------------------------------- library(reshape2) library(png)

Is it possible to dither a gradient drawable?

心已入冬 提交于 2019-12-18 03:05:23
问题 I'm using the following drawable: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:startColor="@color/content_background_gradient_start" android:endColor="@color/content_background_gradient_end" android:angle="270" /> </shape> The problem is that I get severe banding on hdpi devices (like the Nexus One and Droid) since the gradient goes from the top of the screen to the very bottom. According

Return CATransform3D to map quadrilateral to quadrilateral

北城余情 提交于 2019-12-18 02:56:25
问题 I'm trying to derive a CATransform3D that will map a quad with 4 corner points to another quad with 4 new corner points. I've spent a little bit of time researching this and it seems the steps involve converting the original Quad to a Square, and then converting that Square to the new Quad. My methods look like this (code borrowed from here): - (CATransform3D)quadFromSquare_x0:(float)x0 y0:(float)y0 x1:(float)x1 y1:(float)y1 x2:(float)x2 y2:(float)y2 x3:(float)x3 y3:(float)y3 { float dx1 = x1

display values in stacked lattice barchart

依然范特西╮ 提交于 2019-12-18 02:46:26
问题 I want to display the values of a 100% bar for each part of it. Unfortunately I don't know how to do it. The graph should be in lattice because of the legend position (I tried it with ggplot2, but you can't show the legend in one row). I'm pleased about any suggestions or ideas. library(lattice) data(postdoc, package = "latticeExtra") colnames(postdoc) <- c("Legendtext 1", "2", "3", "4", "5") colorset <- simpleTheme(col = c(rgb(166,27,30,maxColorValue = 255), rgb(192,80,77,maxColorValue = 255

Simplified Bresenham's line algorithm: What does it *exactly* do?

泪湿孤枕 提交于 2019-12-18 02:43:10
问题 Based on Wikipedia's article on Bresenham's line algorithm I've implemented the simplified version described there, my Java implementation looks like this: int dx = Math.abs(x2 - x1); int dy = Math.abs(y2 - y1); int sx = (x1 < x2) ? 1 : -1; int sy = (y1 < y2) ? 1 : -1; int err = dx - dy; while (true) { framebuffer.setPixel(x1, y1, Vec3.one); if (x1 == x2 && y1 == y2) { break; } int e2 = 2 * err; if (e2 > -dy) { err = err - dy; x1 = x1 + sx; } if (e2 < dx) { err = err + dx; y1 = y1 + sy; } }

Simplified Bresenham's line algorithm: What does it *exactly* do?

爷,独闯天下 提交于 2019-12-18 02:43:06
问题 Based on Wikipedia's article on Bresenham's line algorithm I've implemented the simplified version described there, my Java implementation looks like this: int dx = Math.abs(x2 - x1); int dy = Math.abs(y2 - y1); int sx = (x1 < x2) ? 1 : -1; int sy = (y1 < y2) ? 1 : -1; int err = dx - dy; while (true) { framebuffer.setPixel(x1, y1, Vec3.one); if (x1 == x2 && y1 == y2) { break; } int e2 = 2 * err; if (e2 > -dy) { err = err - dy; x1 = x1 + sx; } if (e2 < dx) { err = err + dx; y1 = y1 + sy; } }