fill

HTML canvas fill difference on Firefox vs Chrome

依然范特西╮ 提交于 2019-12-11 00:03:51
问题 Consider the snippet below - available on jsFiddle: http://jsfiddle.net/Xqu5U/2/ ctx = document.getElementById('canvas').getContext('2d'); ctx.beginPath(); ctx.fillStyle = '#FF0000'; for (var i = 0; i < 20; i++) { ctx.arc(i * 10, 50 + Math.sin(i * 0.5) * 15, 2, 0, Math.PI * 2); } ctx.fill(); It works as expected on Google Chrome, but Firefox renders a fill from the last arc to the first one. How can the snippet above be updated to get Firefox drawing the arcs exactly like Chrome? 回答1: I found

How to plot correct colors in R maps library

别来无恙 提交于 2019-12-10 21:56:15
问题 I am trying to plot specific colors for specific countries using R maps library. I can fill in the colors but they are not correctly associated with their respective countries. I wonder if someone could have a clue why? My data frame is «filld» and has 3 columns: the first is the countries names, the second is just some numeric data, and the 3rd is the color: countries toplot color 1 Argentina -1 red 2 Armenia -1 red 3 Australia -1 red 4 Bahrain -1 red 5 Botswana -1 red 6 Belgium -1 red 7

Filling memory with random bytes - C/Objective-C

我只是一个虾纸丫 提交于 2019-12-10 17:29:02
问题 I'm using CommonCrypto for encryption in Objective-C (AES256) and I'd like to provide an IV (initialization vector) for a more secure encryption. I'm currently doing this: const void* iv = malloc(kCCBlockSizeAES128); // EDIT: //if (!iv) { // iv = NULL; //} and then I create the cryptor object: CCCryptorRef cryptor; CCCryptorStatus cryptStatus = CCCryptorCreate(operation, kCCAlgorithmAES128, kCCOptionPKCS7Padding, keyPtr, kCCKeySizeAES256, iv, &cryptor); The problem is that encryption this way

Change outline and fill colors of histogram with qplot

时光毁灭记忆、已成空白 提交于 2019-12-10 14:37:00
问题 I have two histograms in one window (using facet) and I would like control over the color of the outline and the fill. I've tried looking up color scales , aes() , + color , + fill , including color and fill in qplot , all resulting in expected plots! My code can be found below. (Note: mussel2 has two columns concentration (a list of numbers) and waterbody (listed or reference). I can provide the data if necessary. I understand this is an elementary question, so I do appreciate your time.

Matlab fill shapes by white

廉价感情. 提交于 2019-12-10 14:09:41
问题 As you see, I have shapes and their white boundaries. I want to fill the shapes in white color. The input is: I would like to get this output: Can anybody help me please with this code? it doesn't change the black ellipses to white. Thanks alot :]] I = imread('untitled4.bmp'); Ibw = im2bw(I); CC = bwconncomp(Ibw); %Ibw is my binary image stats = regionprops(CC,'pixellist'); % pass all over the stats for i=1:length(stats), size = length(stats(i).PixelList); % check only the relevant stats (the

Fill the space of a div

旧城冷巷雨未停 提交于 2019-12-10 04:33:10
问题 I would like an element to fill the remaining space of a parent div. I have managed to do this, You can see it here "link removed" but the filling div (right) sits underneath the left div. I bascially want the right div to start where the left div finishes. Hope this make sense. <html> <head> <title></title> <style type="text/css"> #left { float:left; width:180px; background-color:#ff0000; height:20px; } #right { width: 100%; background-color:#00FF00; height:30px; } </style> </head> <body>

order and fill with 2 different variables geom_bar ggplot2 R

こ雲淡風輕ζ 提交于 2019-12-09 17:59:00
问题 I have a question concerning the fill field in geom_bar of the ggplot2 package. I would like to fill my geom_bar with a variable (in the next example the variable is called var_fill ) but order the geom_plot with another variable (called clarity in the example). How can I do that? Thank you very much! The example: rm(list=ls()) set.seed(1) library(dplyr) data_ex <- diamonds %>% group_by(cut, clarity) %>% summarise(count = n()) %>% ungroup() %>% mutate(var_fill= LETTERS[sample.int(3, 40,

How to make an SVG “line” with a border around it?

☆樱花仙子☆ 提交于 2019-12-08 15:00:39
问题 I have a little svg widget whose purpose is to display a list of angles (see image). Right now, the angles are line elements, which only have a stroke and no fill. But now I'd like to have an "inside fill" color and a "stroke/border" around it. I'm guessing the line element can't handle this, so what should I use instead? Notice that the line-endcap of the line's stroke is rounded. I'd like to maintain this effect in the solution. <svg height="160" version="1.1" viewBox="-0.6 -0.6 1.2 1.2"

Replace NA values in dataframe starting in varying columns

巧了我就是萌 提交于 2019-12-08 12:48:02
问题 This is a variation on the NA theme that I have not been able to find an answer to. I have monthly observations by column with a large number of series by row. Some missing values are genuine but some should be zero. I want to replace missing values for a given series with zeros but only after a value for that series has been observed. For example, given: Mth1 Mth2 Mth3 Mth4 1 1 2 1 3 2 NA 3 2 1 3 NA 2 1 NA 4 NA NA 2 NA 5 2 2 NA 2 I want to change this to: Mth1 Mth2 Mth3 Mth4 1 1 2 1 3 2 NA 3

Change the fill of all elements inside an svg using javascript

十年热恋 提交于 2019-12-08 10:46:55
问题 I would like to change the fill color of all elements inside an SVG. The elements are both type rect and polygon. I have not set a default color. Here is a sample file: http://www.kingoslo.com/instruments/test.svg How can I do this most elegantly? 回答1: If you have jQuery: $('svg').children().css('fill', '#ffffff'); EDIT: Note that this assumes the rects and polygons are the direct children of the svg element. 回答2: Another variant similar to the one by Robert Longson: document.documentElement