graphics

Align axis label on the right with ggplot2

大兔子大兔子 提交于 2020-01-12 12:50:47
问题 Consider the following d = data.frame(y=rnorm(120), x=rep(c("bar", "long category name", "foo"), each=40)) ggplot(d,aes(x=x,y=y)) + geom_boxplot() + theme(axis.text.x=element_text(size=15, angle=90)) The x-axis labels are aligned by the center of the label. Is it possible to automatically align on the right so that every label would end right below the graph? 回答1: This is precisely what the hjust and vjust parameters are for in ggplot . They control the horizontal and vertical justification

the internalformat of Texture

半腔热情 提交于 2020-01-12 10:19:19
问题 Look at the following OpenGL function: void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * data); I know the parameter format and type describe the format and type of the image data,but I don't understand the prameter internalFormat .How should I set its value in my application? For example,I create a texture like this: glTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE8,size,size,0,GL_LUMINANCE,GL

the internalformat of Texture

瘦欲@ 提交于 2020-01-12 10:19:09
问题 Look at the following OpenGL function: void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * data); I know the parameter format and type describe the format and type of the image data,but I don't understand the prameter internalFormat .How should I set its value in my application? For example,I create a texture like this: glTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE8,size,size,0,GL_LUMINANCE,GL

C# paint program flickering

99封情书 提交于 2020-01-12 08:28:57
问题 I'm trying to make a simple paint program in C#, but it keeps flickering when I'm drawing, like I need some kind of double buffering, but I don't know how to do it. I am drawing on a Panel and I'm using a Bitmap to store the graphics. Here's my code: public partial class Form1 : Form { private Bitmap drawing; private bool leftDown = false; private int prevX; private int prevY; private int currentX; private int currentY; public Form1() { InitializeComponent(); drawing = new Bitmap(panel1.Width

Efficiently draw a grid in Windows Forms

断了今生、忘了曾经 提交于 2020-01-12 07:55:43
问题 I'm writing an implementation of Conway's Game of Life in C#. This is the code I'm using to draw the grid, it's in my panel_Paint event. g is the graphics context. for (int y = 0; y < numOfCells * cellSize; y += cellSize) { for (int x = 0; x < numOfCells * cellSize; x += cellSize) { g.DrawLine(p, x, 0, x, y + numOfCells * cellSize); g.DrawLine(p, 0, x, y + size * drawnGrid, x); } } When I run my program, it is unresponsive until it finishes drawing the grid, which takes a few seconds at

Adding Points, Legends and Text to plots using xts objects

岁酱吖の 提交于 2020-01-12 07:49:04
问题 I am starting on a bit of analysis on pairs of stocks (pairs trading) and here is the function I wrote for producing a graph (pairs.report - listed below). I need to plot three different lines in a single plot. The function I have listed does what I want it to do, but it will take a bit of work if I want a fine customisation in the x-axis (the time line). As it is, it prints just the years (for 10 years of data) or the months (for 6 months of data) in the x-axis, with no formatting for ticks.

Selectable circular imageview like Google+

拜拜、爱过 提交于 2020-01-12 05:30:07
问题 How can I create a selectable circular ImageView like in the current Google+ app used for the profile pictures? This is what I refer to: The image above is unselected and the below is selected. I try to replicate the profile pictures 1 to 1. My work so far: loadedImage is the Bitmap which is displayed mImageView.setBackground(createStateListDrawable()); mImageView.setImageBitmap(createRoundImage(loadedImage)); The used methods: private Bitmap createRoundImage(Bitmap loadedImage) { Bitmap

Z-fighting solutions in depth test in OpenGL - how do they work?

折月煮酒 提交于 2020-01-12 04:40:33
问题 Description I've had major problems with Z-Fighting in OpenGL and I've spent quite some time finding solutions for this problem. Some of the ones I've found and I understand and didn't like: Moving polygons away from each other ( like glPolygonOffset in OpenGL ) Dividing the scene according to Z coordinate and drawing parts of the scene with separate clean z-buffers. The ones I don't understand: Using Projection Matrix https://software.intel.com/en-us/articles/alternatives-to-using-z-bias-to

Z-fighting solutions in depth test in OpenGL - how do they work?

冷暖自知 提交于 2020-01-12 04:40:27
问题 Description I've had major problems with Z-Fighting in OpenGL and I've spent quite some time finding solutions for this problem. Some of the ones I've found and I understand and didn't like: Moving polygons away from each other ( like glPolygonOffset in OpenGL ) Dividing the scene according to Z coordinate and drawing parts of the scene with separate clean z-buffers. The ones I don't understand: Using Projection Matrix https://software.intel.com/en-us/articles/alternatives-to-using-z-bias-to

Background image dimension for Navigation Drawer header

独自空忆成欢 提交于 2020-01-12 00:39:33
问题 Basically I liked the background used by Mr. Jonathan Lee for Navigation Drawer header back ground in google official link http://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-content So I wanted to reproduce something similar inspired by that. I believe that I need to make a similar design in photoshop and set it as the background image. But the question is, what should be the dimensions and pixels so that it matches different kind of devices? The above link