w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using ggplot2: Create faceted scatterplot with scaled and moved density
I'm not sure if this completely answers your question, but it was too long to put in a comment, so... In response to your second chunk of code in your question, since you've already defined x=value, you can use x instead of value in your definition of y. stat_density(aes(x=value,y=..scaled..*diff(range(x)) + min(x)),position='identity',geom='line') This seems to fix your error and produces the following plot: The only problem is, of course, if you have data with low y-values, then you're still going to overlap your density curves with your scatterplot. But, if this isn't the case, I personally think this is a fairly informative figure, as long as you can communicate effectively that the y axis values aren't important in interpreting the density curves--only the shapes of the curves

Categories : R

create a field in solr that will index both a double value and the floor of that double value
You can try these options :- If you are feeding the data, handle it on the client side to index it as a multivalued field with both the values, the double as well as the rounded one If you are using DIH you can easily use the ScriptTransformer to convert it into multivalued fields Example - Data Config - Add custom field - <script><![CDATA[ function addfield(row){ var fieldName = row.get('double_value'); // Round it row.put(fieldName, double_rounded); return row; } ]]></script> Else, just write a Custom filter which would store both the Original token and the Rounded value in the index. With the fields being Mark Float, the Range Queries also should work fine.

Categories : Solr

error: cannot convert 'double (evaluator::*)(double, double)' to 'double (*)(double, double)' in assignment
This: double (*ope)(double, double); should be: double (evaluator::*ope)(double, double); // ^^^^^^^^^^^^ because you are using a pointer to member.

Categories : C++

Is it possible to create a pow(double a, double b) function in C without assembly?
You can calculate anything without assembly (the same way you might calculate it by hand), but it will be much slower; that's why no one does these things without using special hardware support.

Categories : C

Double group by in cakePhp
I think you subquery needs the alias to GROUP BY again SELECT q.a, SUM(q.bTotal) as fullTotal FROM (SELECT a, SUM(b) * c as bTotal FROM Table1 GROUP BY a) q GROUP BY q.a In cakephp $this->YourModel->query(' SELECT q.a, SUM(q.bTotal) as fullTotal FROM (SELECT a, SUM(b) * c as bTotal FROM Table1 GROUP BY a) q GROUP BY q.a'); OR App::uses('AppModel', 'Model'); class MYModel extends Model { public function myfunction() { return $this->query(' SELECT q.a, SUM(q.bTotal) as fullTotal FROM (SELECT a, SUM(b) * c as bTotal FROM Table1 GROUP BY a) q GROUP BY q.a'); } }

Categories : PHP

MongoDB double $group aggregation
Try this pipeline: [ {$unwind:"$results"}, {$match: {"results.discipline":{$in:["football", "basketball"]}}}, {$group{_id:{player_id:"$player_id",league_id:"$league_id"}, 'average':{$avg:"$results.score"}}} ] it works for me with your doc: { "result" : [ { "_id" : { "player_id" : 0, "league_id" : 2 }, "average" : 23.195 } ], "ok" : 1 } UPD. If you want to group again, by league_id: [{$unwind:"$results"}, {$match: {"results.discipline":{$in:["football", "basketball"]}}}, {$group:{_id:{player_id:"$player_id",league_id:"$league_id"}, 'average':{$avg:"$results.score"} }}, {$group:{_id:"$_id.league_id", 'average':{$avg:"$average"} }} ] { "result" : [ { "_id" : 2, "average" : 23.195 } ], "ok" : 1 }

Categories : Mongodb

Why capturing group results in double matches regex
First script: The first result is the whole pattern, the second is the capturing group Second script: the only result is the whole pattern. Capturing groups are not only to refer later in the pattern, they are displayed in results too. When you use a capturing group with split, the capturing group is returned with results and since the separator is supposed to slice the string, it is normal that you obtain ["", " ", ""] as result with " " as input string and /(s)/ as pattern. More informations about split. When you write " ".match(/(s)/) the result returned is the first match. This result is unique and contains: the whole match capturing group(s) index of the match input string When you write " ".match(/(s)/g) the result returned is all the matches: whole match 1 whole match 2 e

Categories : Javascript

Can I create a user in AWS IAM that only has rights to create users and place them in a specific Group?
Yes, you need to create an IAM user and then give it this iam policy. { "Statement": [ { "Sid": "Stmt1375475989975", "Action": [ "iam:AddUserToGroup", "iam:CreateUser" ], "Effect": "Allow", "Resource": "arn:aws:iam::152997954706:user/AMISTACK-02-WEB-User-WYEMFOJZ4BDP" } ] } arn:aws:iam::152997954706:user/AMISTACK-02-WEB-User-WYEMFOJZ4BDP is an example user ARN. You'll need to add in yours specific user's arn. An easy way to create policy files is to use: http://awspolicygen.s3.amazonaws.com/policygen.html

Categories : Amazon

Cannot create a Fractional from Double?
I'm not sure I understand your distinction between A and B. But since you have f: A => B, I assume they can somehow be converted into each other? Then looking at the code, my impression is that A is the main type, so why not convert all B type things into A instead of the other way around? Then you can spare any conversions to Double, that seems not a good idea anyway. /* * 'f' is a "strictly increasing function" (derivative > 0). * The sweep gives the value at which it gives 'goal' (within '+-bEps' margins). */ object NewtonianSweep { def apply[A: Fractional, B: Fractional]( // f: A => B, fDerivate: A => A, goal: B, bEps: B, initialSeed: A, aMin: A, aMax: A )(f: B => A) : A = { assert( initialSeed >= aMin && initialS

Categories : Scala

Does double.IsInfinity(value) cover double.IsPositiveInfinity(value) and double.IsNegativeInfinity(value))?
Yes, the extra checks are redundant. As noted on MSDN for Double.IsInfinity: Returns a value indicating whether the specified number evaluates to negative or positive infinity

Categories : C#

How to add 2d points to a 3d scatterplot
Yes, for any 3D point P = [x y z] you can create the 3 shadows by creating 3 new points p1 = [0 y z] p2 = [x 0 z] p3 = [x y 0] So, in MATLAB, if you have a point cloud, P_cloud = [... x1 y1 z1 x2 y2 z2 x3 y3 z3 ... ]; Just plot P_cloud_YZ = [... 0 y1 z1 0 y2 z2 0 y3 z3 ... ]; P_cloud_XZ = [... x1 0 z1 x2 0 z2 x3 0 z3 ... ]; P_cloud_XY = [... x1 y1 0 x2 y2 0 x3 y3 0 ... ]; or, of course, re-use the same data [P_cloud(:, [2 3]) zeros(size(P,1),1)] [P_cloud(:, [1 3]) zeros(size(P,1),1)] [P_cloud(:, [1 2]) zeros(size(P,1),1)]

Categories : R

MS Access Create column with Double data type
The following Access SQL CREATE TABLE statement creates a table with a field of type "Double" CREATE TABLE Gord (dblField DOUBLE) Look here for a list of the various Access field type names and constants: http://allenbrowne.com/ser-49.html

Categories : Ms Access

Autofixture - create a float, double or decimal with remainder
One option is to use a custom ISpecimenBuilder: var fixture = new Fixture(); fixture.Customizations.Add( new RandomDoublePrecisionFloatingPointSequenceGenerator()); The RandomDoublePrecisionFloatingPointSequenceGenerator could look like below: internal class RandomDoublePrecisionFloatingPointSequenceGenerator : ISpecimenBuilder { private readonly object syncRoot; private readonly Random random; internal RandomDoublePrecisionFloatingPointSequenceGenerator() { this.syncRoot = new object(); this.random = new Random(); } public object Create(object request, ISpecimenContext context) { var type = request as Type; if (type == null) return new NoSpecimen(request); return this.CreateRandom(type); }

Categories : C#

How to create double line text in ActionBar like new GMail app
The default ActionBar has a title and sub-title: http://developer.android.com/reference/android/app/ActionBar.html#setSubtitle(int) Please note that DISPLAY_SHOW_TITLE needs to be set.

Categories : Android

Scatterplot colour based on y-value
You can create the color levels using cut, then using the vector of colors in your plot. set.seed(1104) x = rnorm(100) y = rnorm(100) colors = c("blue", "red", "green") breaks = c(y1=0, y2=1) # first plot (given breaks values) y.col2 = as.character(cut(y, breaks=c(-Inf, breaks, Inf), labels=colors)) plot(x, y, col=y.col2, pch=19) # second plot (given number of breaks) y.col = as.character(cut(y, breaks=3, labels=colors)) plot(x, y, col=y.col, pch=19)

Categories : R

draw cube into 3D scatterplot in RGL
Here's something I had around for various purposes. It should get you started. box <- data.frame( x = c(1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1), y = c(1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1), z = c(1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1)) segments3d(box$x, box$y, box$z, line_antialias = TRUE, col = "blue") points3d(0,0,0, col = "red", size = 5, point_antialias = TRUE)

Categories : R

Use own colormap in a plot according to a 3rd value (no scatterplot)
There is no buit-in function to do what you want, so I've written a python script to answer your question (the comments explain the code): import matplotlib.pyplot as plt import numpy as np from matplotlib import cm fig = plt.figure() width=4.467 # width in inches of my figure height=4.344 # height in inches of my figure DPI=90 # dots per inch xmin=0 xmax=2*np.pi xx_step=1.0*(xmax-xmin)/(width*DPI) print "xx_step:", xx_step xx=np.arange(xmin, xmax+xx_step, xx_step) ymin=-1 ymax=1 yy_step=1.0*(ymax-ymin)/(height*DPI) print "yy_step:", yy_step yy=np.arange(ymin, ymax+yy_step, yy_step) x_surf, y_surf = np.meshgrid(xx, yy) # generate a mesh z_surf = np.zeros(x_surf.shape)+float('+inf') # to paint with white color the regions that will not contain

Categories : Python

Displaying Points in Scatterplot
If you're trying to print the coordinates, you could use the labels argument to the identify() function. identify(temp1, temp2, labels=paste(temp1, temp2, sep=","))

Categories : R

ggplot2 scatterplot and labels
Lose the inverted commas, at the moment you're making a plot of the text value... Having looked again, you will have problems with the brackets in your variable name (Distance (bp)). Change that to something without the brackets, then make the ggplot call without the inverted commas: #Assuming Distance (bp) is the first column names(scatterPlotData)[1] <- "Distance" p <- ggplot(scatterPlotData, aes(Distance, Intensity) + geom_point() As for non-overlapping labels, this is a vexed issue with lots of discussion on SO - I think you'll not get great responses from such a vague question here.

Categories : R

What CultureInfo or NumberFormat should I use to create html/css percentages with double.ToString?
You can specify your own custom format string: using System.Globalization; class Program { static void Main(string[] args) { double d = 12.345; string s = string.Format(CultureInfo.InvariantCulture, "{0:0.00}%", d); } } Here are some output examples of numeric format strings: Custom Numeric Format Strings Output Examples

Categories : C#

Create a two dimensional array of different data types (Date and double)
Instead of using an Array, use a List. That way you can use List.add() and you don't need to worry about how many elements are going to be in that list. Elements in a list can be access similar to an array by using List.get(index) to get the objects or a more generic for( element : List ) {}.

Categories : Java

Grouping Series with different y-values in a scatterplot
At the moment this is about my best guess as to what you want, though I fear is not right: Please note that an image (even a rough sketch) is often helpful when requiring a chart and that the Excel version may be relevant.

Categories : Excel

How to obtain R's scatterplot car formula and coefficients?
In the first case, you can see the info by summary(lm(prestige ~ income, data = Prestige)) In the 2nd case, something similar will likely apply but I don't know that package or smoothing method. It's surely not as simple as a linear fit. Take a look at ?mgcv-FAQ.

Categories : R

d3 x axis too short for scatterplot content
Likely the problem is that your defined domain doesn't include the full extent of your data. The scale domain/range are used to map ranges of data values so that if your domain is [0,10] and your range is [0,100], you will get values like range(0) = 0, range(1) = 10, range(2) = 20... range(10) = 100 (depending on the kind of scale used). Since it's just mapping domain to range, if you give it a value that it can't map, you aren't likely to get a value inside of your range's extent. Eg. if you do range(11) you won't get a value between 0 and 100. Since the range value is what your axis and plot are likely using to build the actual svg, the points that fall outside of your domain are going to end up off your plot (or NaN or something). Try deriving the domain from the data itself. D3 has

Categories : Javascript

NVD3 Scatterplot Date Object
I was trying to do the same thing. You have to have the time as Unix Time Stamp format. I thinks this will help you: nvd3.js : no mouseover datapoint effects in a line chart and also this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime

Categories : Javascript

scatterplot with alpha transparent histograms in R
I have no idea whether there is a package that does that directly, but I'm sure this can be done in R. Transparency is easy: you add another two digits to the RGB specification of a color for a given transparency: #FF0000 # red #FF0000FF # full opacity #FF000000 # full transparency Combining different plots is also easy using the layout function. As for the vertical density plot, it is just the same as the horizontal plot with x and y switched. The example given here can easily be expanded to include colors, smaller margins etc. I can try to come up with a more elaborate example if this description is not sufficient.

Categories : R

Scatterplot with X and Y axis color scales
Here you have a first approach using base graphics for your first problem (mixing two color gradients). ## use white->yellow for the x-axis and white->blue for the y-axis chooseColors <- function(x, y) { x <- 1-x/max(x) y <- 1-y/max(y) return(rgb(green=y, red=y, blue=x)) } ## example values for the whole range values <- expand.grid(1:100, 1:100) ## plot it plot(values, col=chooseColors(values[,1], values[,2]), pch=16) A more realistic toy example: set.seed(1) n <- 50 values <- cbind(sample(1:15, size=n, replace=TRUE), sample(1:15, size=n, replace=TRUE)) ## plot it plot(values, col=chooseColors(values[,1], values[,2]), pch=16)

Categories : R

Scatterplot with ugly margins when using log scale
Maybe you want p + scale_x_log10(oob=squish_infinite) + scale_y_log10(oob=squish_infinite) I don't really know what you expect to happen for those values that can be negative or infinite, but one general advice when transformations don't do what you want is to perform them outside of ggplot2. Something like this might be useful, library(plyr) df2 <- colwise(log10)(df) # log transform columns df2 <- colwise(squish_infinite)(df2) # do something with infinites p %+% df2 # plot the transformed data

Categories : R

R scatterplot ylim error NA values
I am not sure what you are looking at. I think this might help. speed <- structure(list(A = c(3.59e-05, 3.75e-05, 9.67e-05, 3.92e-05, 2.14e-05, 9.8e-05, 0.000228481, 0.000228481, 0.000415583, 0.000859052, 0.002014948, 0.004079371, 0.00406138, 0.004353728, 0.008455587, 0.007780939, 0.018260469, NA, NA, NA, NA, NA, NA), B = c(4.76, 6.28, 10.5, 10.6, 12.3, 12.8, 16, 16.8, 20.7, 25.2, 34.4, 36.4, 37.7, 43.6, 48.7, 49.2, 66.5, NA, NA, NA, NA, NA, NA), C = c(1.734691244, 2.016976959, 1.707373272, 1.461511521, 0.805880184, 0.417509677, 0.427070968, 0.220364977, 0.21763318, 0.170282028, 0.169826728, 0.095612903, 0.094247005, 0.048717051, 0.044072995, 0.034921475, 0.023721106, 0.022901567, 0.018485161, 0.015252535, 0.008240922, 0.003942894, 0.002868387), D = c(176, 175, 169, 1

Categories : R

Datamatrix in R - extracting data from scatterplot
Question 1 - this is a for loop - it is executing once for each row in the matrix or data frame x (not sure what x is here exactly). Changing it to 2 will mean the loop happens one less time. Without the rest of the code I can't say much else. Question 2 - can you post the whole code? It apparently needs to evaluate that expression and one or more of the values is missing.

Categories : R

How can I color dots in a xy scatterplot according to column value?
Non-VBA Solution: You need to make an additional group of data for each color group that represent the Y values for that particular group. You can use these groups to make multiple data sets within your graph. Here is an example using your data: A B C D E F G ---------------------------------------------------------------------------------------------------------------------- 1| COMPANY XVALUE YVALUE GROUP Red Orange Green 2| Apple 45 35 red =IF($D2="red",$C2,NA()) =IF($D2="orange",$C2,NA()) =IF($D2="green",$C2,NA()) 3| Xerox 45 38 red =IF($D3="red",$C3,NA()) =IF($D3="orange",$C3,NA()

Categories : Excel

How to create a Python dictionary with double quotes as default quote format?
json.dumps() is what you want here, if you use print json.dumps(pairs) you will get your expected output: >>> pairs = {'arun': 'maya', 'bill': 'samantha', 'jack': 'ilena', 'hari': 'aradhana'} >>> print pairs {'arun': 'maya', 'bill': 'samantha', 'jack': 'ilena', 'hari': 'aradhana'} >>> import json >>> print json.dumps(pairs) {"arun": "maya", "bill": "samantha", "jack": "ilena", "hari": "aradhana"}

Categories : Python

Using sequences to create group ID
You have a problem, because SQL tables are inherently unordered. The following "should" logically work, although it won't in practice: select ii.*, (item_id - rownum) as grp_id from item_ids ii; A sequence of item_ids in order minus the row number is constant. You can use that for a group, at least for a given item. To handle multiple items, concatenate the values together: select ii.*, item||'-'||(item_id - rownum) as grp_id from item_ids ii; To really make this work, you need to add an order by -- this guarantees the ordering of the results from the select. This might work, assuming that there are "holes" between the groups: select ii.*, item||'-'||(item_id - rownum) as grp_id from item_ids ii order by item, item_id; Otherwise, you need some other column to determine the pro

Categories : SQL

Auto or Random Scatterplot Matrix Selections d3.js
You could draw the brush programatically using the extent() method. also, look at some of the examples in this discussion. Using the same example you posted, add this to the end of the csv callback: var e = [[0.4,1.4],[1.4,2.4]]; //set brush range brush.extent(e); cell.call(brush); //draw brush and if you want the brush to simulate user interaction: cell.select(".extent") .transition() .attr('width',20).attr('height',20) .attr('x',10).attr('y',10) .transition() .attr('width',80).attr('height',80);

Categories : Javascript

Use ggplot2 to make a scatterplot with categorical axes
Try this for example : library(ggplot2) ggplot(dat,aes(x=region,y=expression, group=species.gene,color=species.gene)) + geom_line()

Categories : R

option to align a label near the scatterplot circle
You can achieve this by setting the text anchor to middle and adding an offset to the y coordinate: svg.selectAll("text") ... .attr("y", function(d) { return d[1] - 10; }) .attr("text-anchor", "middle") ... Jsfiddle here.

Categories : Javascript

How do I create a group with a source_id reference?
The data in sourceid still needs to be set in the second example before you are able to retrieve it. here is what the docs have to say about sourceid: String SOURCE_ID read/write: String that uniquely identifies this row to its source account. Typically it is set at the time the raw contact is inserted and never changed afterwards. The one notable exception is a new raw contact: it will have an account name and type (and possibly a data set), but no source id. This indicates to the sync adapter that a new contact needs to be created server-side and its ID stored in the corresponding SOURCE_ID field on the phone.

Categories : Android

how to create a group permission in django
The following answer helped me in setting up groups. from django.contrib.auth.models import User, Group, Permission from django.contrib.contenttypes.models import ContentType content_type = ContentType.objects.get(app_label='myapp', model='BlogPost') permission = Permission.objects.create(codename='can_publish', name='Can Publish Posts', content_type=content_type) user = User.objects.get(username='duke_nukem') group = Group.objects.get(name='wizard') group.permissions.add(permission) user.groups.add(group)

Categories : Django

Create Active Directory Group using C#
Try GroupPrincipal oGroupPrincipal = new GroupPrincipal(ctx, samAccountName); And oGroupPrincipal.Save(ctx); Code samples for Active Directory - http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C# Active Directory With C#

Categories : C#

How to create a group of testers on testflight
First invite the testers to TestFlight. You can assign the people in a TestFlight team to a distribution list. Integrate the TestFlight SDK into your app so you can track the usage (sessions) on TestFlight.

Categories : Misc



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.