drawing

Restrict fitted regression line (abline) to range of data used in model

﹥>﹥吖頭↗ 提交于 2021-02-19 23:44:20
问题 Is it possible to draw an abline of a fit only in a certain range of x-values? I have a dataset with a linear fit of a subset of that dataset: # The dataset: daten <- data.frame(x = c(0:6), y = c(0.3, 0.1, 0.9, 3.1, 5, 4.9, 6.2)) # make a linear fit for the datapoints 3, 4, 5 daten_fit <- lm(formula = y~x, data = daten, subset = 3:5) When I plot the data and draw a regression line: plot (y ~ x, data = daten) abline(reg = daten_fit) The line is drawn for the full range of x-values in the

Restrict fitted regression line (abline) to range of data used in model

拥有回忆 提交于 2021-02-19 23:39:06
问题 Is it possible to draw an abline of a fit only in a certain range of x-values? I have a dataset with a linear fit of a subset of that dataset: # The dataset: daten <- data.frame(x = c(0:6), y = c(0.3, 0.1, 0.9, 3.1, 5, 4.9, 6.2)) # make a linear fit for the datapoints 3, 4, 5 daten_fit <- lm(formula = y~x, data = daten, subset = 3:5) When I plot the data and draw a regression line: plot (y ~ x, data = daten) abline(reg = daten_fit) The line is drawn for the full range of x-values in the

Filling a polygon

妖精的绣舞 提交于 2021-02-19 08:44:17
问题 I created this function that draws a simple polygon with n number of vertexes: void polygon (int n) { double pI = 3.141592653589; double area = min(width / 2, height / 2); int X = 0, Y = area - 1; double offset = Y; int lastx, lasty; double radius = sqrt(X * X + Y * Y); double quadrant = atan2(Y, X); int i; for (i = 1; i <= n; i++) { lastx = X; lasty = Y; quadrant = quadrant + pI * 2.0 / n; X = round((double)radius * cos(quadrant)); Y = round((double)radius * sin(quadrant)); setpen((i * 255)

Programmatically draw SVG icon with specific azimuth?

帅比萌擦擦* 提交于 2021-02-11 15:12:40
问题 We currently have a leaflets map that plots several points. The service (consumed by the map) includes, among other things, the coordinates and the path for a static svg icon. That's working fine. The next step is to create the actual icon so it looks like the icon below. In this example, there are 3 "groups" with 4 "lines" each. Each "line" has its own azimuth (the angle). Also, each "line" has its own length. The angle is the same any way you look at it, but the length is in miles, since

Programmatically draw SVG icon with specific azimuth?

删除回忆录丶 提交于 2021-02-11 15:12:36
问题 We currently have a leaflets map that plots several points. The service (consumed by the map) includes, among other things, the coordinates and the path for a static svg icon. That's working fine. The next step is to create the actual icon so it looks like the icon below. In this example, there are 3 "groups" with 4 "lines" each. Each "line" has its own azimuth (the angle). Also, each "line" has its own length. The angle is the same any way you look at it, but the length is in miles, since

Different html canvas coordinates

删除回忆录丶 提交于 2021-02-10 15:00:38
问题 i made 2 deference size html canvas to drawing First canvas = width : 400px,height:200px Second canvas = width : 200px,height :100px Now when i drawing in first html canvas i send that coordinates(x1,y1,x2,y2) to second canvas. When first canvas coordinates send in second canvas it's not drawing in same place as first canvas. is there way to equal first canvas coordinates to second one without changing canvas width and height . ctx.beginPath(); ctx.lineWidth = 5; ctx.lineCap = 'round'; ctx

Different html canvas coordinates

不打扰是莪最后的温柔 提交于 2021-02-10 14:59:48
问题 i made 2 deference size html canvas to drawing First canvas = width : 400px,height:200px Second canvas = width : 200px,height :100px Now when i drawing in first html canvas i send that coordinates(x1,y1,x2,y2) to second canvas. When first canvas coordinates send in second canvas it's not drawing in same place as first canvas. is there way to equal first canvas coordinates to second one without changing canvas width and height . ctx.beginPath(); ctx.lineWidth = 5; ctx.lineCap = 'round'; ctx

C# Rotating JPG without losing too much quality

僤鯓⒐⒋嵵緔 提交于 2021-02-08 04:29:08
问题 So I'm reading in files from a directory, figuring out which way they need to be rotated. Rotating and then saving. That part works... The issue is, after it saves the file it gets recompressed and I go from 1.5meg images to 250k images. I need to keep the file size around the original. I tried using jhead.exe and calling it from a command line but couldn't get any of my arguments to pass in correctly. Here's my code snipit to detect, rotate, and save. foreach (FileInfo f in dir.GetFiles("*

gtkmm drawing single pixels

[亡魂溺海] 提交于 2021-02-07 08:36:59
问题 Refering to the example on the Documentation for Gtkmms GdkRGB: #include <gtk/gtk.h> #define IMAGE_WIDTH 256 #define IMAGE_HEIGHT 256 guchar rgbbuf[IMAGE_WIDTH * IMAGE_HEIGHT * 3]; gboolean on_darea_expose (GtkWidget *widget, GdkEventExpose *event, gpointer user_data); int main (int argc, char *argv[]) { GtkWidget *window, *darea; gint x, y; guchar *pos; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); darea = gtk_drawing_area_new (); gtk_widget_set_size_request (darea,

Drawing with Java: Applying Borders/Outlines to Shapes

旧巷老猫 提交于 2021-02-04 21:35:22
问题 I can't figure out how to get "g.setStroke(new BasicStroke(5));" to be set to all my created shapes (in this case ovals). My code: import java.awt.*; import java.awt.Color; import java.awt.Graphics2D; import java.awt.BasicStroke; public class Rings { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(300, 300); Graphics2D g = panel.getGraphics(); g.setStroke(new BasicStroke(5)); // Sets Outer Line Width of Shapes g.setColor(new Color(255, 0, 0)); g.fillOval(50, 50,