graphics

Text labels with background colour in R

℡╲_俬逩灬. 提交于 2020-05-25 17:15:56
问题 I was wondering if there is a simple way to add text labels with a contrasting background to an R plot using the base graphic system. Until now I have always used the rect() function together with graphics::strheight() and graphics::strwidth() to separately create the background box on which I then place my text using text() : # Prepare a noisy background: plot(x = runif(1000), y = runif(1000), type = "p", pch = 16, col = "#40404050") ## Parameters for my text: myText <- "some Text"

Text labels with background colour in R

佐手、 提交于 2020-05-25 17:15:38
问题 I was wondering if there is a simple way to add text labels with a contrasting background to an R plot using the base graphic system. Until now I have always used the rect() function together with graphics::strheight() and graphics::strwidth() to separately create the background box on which I then place my text using text() : # Prepare a noisy background: plot(x = runif(1000), y = runif(1000), type = "p", pch = 16, col = "#40404050") ## Parameters for my text: myText <- "some Text"

How to refresh graphics in C#

不羁的心 提交于 2020-05-23 11:53:25
问题 I have a timer in a panel and when the timer ticks, it changes the coordinates of a rectangle. I have tried two approaches: 1. Inside onPaint method, 2. Timer calls a function to create graphics and draw the moving rectangle The first one does not work, but when I switch the windows, it moved once. The second one works with problem. It is moving but leaving the previous position filled with color, which means the graphics are not refreshed. I simply use g.FillRectangles() to do that. Can

Calculating the perspective projection matrix according to the view plane

被刻印的时光 ゝ 提交于 2020-05-18 18:23:51
问题 I'm working with openGL but this is basically a math question. I'm trying to calculate the projection matrix, I have a point on the view plane R(x,y,z) and the Normal vector of that plane N(n1,n2,n3). I also know that the eye is at (0,0,0) which I guess in technical terms its the Perspective Reference Point. How can I arrive the perspective projection from this data? I know how to do it the regular way where you get the FOV, aspect ration and near and far planes. 回答1: I think you created a

Calculating the perspective projection matrix according to the view plane

∥☆過路亽.° 提交于 2020-05-18 18:23:31
问题 I'm working with openGL but this is basically a math question. I'm trying to calculate the projection matrix, I have a point on the view plane R(x,y,z) and the Normal vector of that plane N(n1,n2,n3). I also know that the eye is at (0,0,0) which I guess in technical terms its the Perspective Reference Point. How can I arrive the perspective projection from this data? I know how to do it the regular way where you get the FOV, aspect ration and near and far planes. 回答1: I think you created a

Can graphics.h header work on 64bit windows?

假装没事ソ 提交于 2020-05-09 10:32:53
问题 I installed graphics.h library on Dev-C++ but it wont run my code as it gives me this error in the compiler: int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX, Here's my code: #include <graphics.h> void main( ) { initwindow(800, 800, "line"); line(200,200,200,600); getch(); } They told me graphics.h can't work on 64-bit windows... Is that right?... 回答1: WinBGIm is a 32-bit library only. There were no 64-bit version of Windows (except for the Itanium) when it was written. 回答2: If

Can graphics.h header work on 64bit windows?

早过忘川 提交于 2020-05-09 10:32:28
问题 I installed graphics.h library on Dev-C++ but it wont run my code as it gives me this error in the compiler: int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX, Here's my code: #include <graphics.h> void main( ) { initwindow(800, 800, "line"); line(200,200,200,600); getch(); } They told me graphics.h can't work on 64-bit windows... Is that right?... 回答1: WinBGIm is a 32-bit library only. There were no 64-bit version of Windows (except for the Itanium) when it was written. 回答2: If

Can graphics.h header work on 64bit windows?

北战南征 提交于 2020-05-09 10:32:27
问题 I installed graphics.h library on Dev-C++ but it wont run my code as it gives me this error in the compiler: int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX, Here's my code: #include <graphics.h> void main( ) { initwindow(800, 800, "line"); line(200,200,200,600); getch(); } They told me graphics.h can't work on 64-bit windows... Is that right?... 回答1: WinBGIm is a 32-bit library only. There were no 64-bit version of Windows (except for the Itanium) when it was written. 回答2: If

[翻译]PyCairo指南--文本

穿精又带淫゛_ 提交于 2020-05-08 03:54:07
PyCairo中的文本 PyCairo指南的这个部分,我们将与文本打交道。 灵魂伴侣 在第一个例子中,我们将在窗口中显示一些歌词。 def on_draw(self, wdith, cr): cr.set_source_rgb(0.1, 0.1, 0.1) cr.select_font_face("Purisa", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL) cr.set_font_size(13) cr.move_to(20, 30) cr.show_text("Most relationships seem so transitory") cr.move_to(20, 60) cr.show_text("They're all good but not the permanent one") cr.move_to(20, 120) cr.show_text("Who doesn't long for someone to hold") cr.move_to(20, 150) cr.show_text("Who knows how to love without being told") cr.move_to(20, 180) cr.show_text("Somebody tell me why I'm on my own

[翻译]PyCairo指南--裁剪和masking

浪尽此生 提交于 2020-05-08 03:53:55
裁剪和masking 在PyCairo指南的这个部分,我么将讨论裁剪和masking操作。 裁剪 裁剪 就是将图形的绘制限定在一定的区域内。这样做有一些效率的因素,同时也可以创建一些非常有趣的效果。PyCairo有一个 clip() 方法来设置裁剪区域。 #!/usr/bin/python ''' ZetCode PyCairo tutorial This program shows how to perform clipping in PyCairo author: Jan Bodnar website: zetcode.com last edited: August 2012 ''' import cairo import gtk import math import glib import random class MainWindow(gtk.Window): def __init__(self): super(self.__class__, self).__init__() self.init_ui() self.load_image() self.init_vars() def init_ui(self): self.darea = gtk.DrawingArea() self.darea.connect("expose_event", self.expose)