w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Plot gradient circles
With some repeated use of clip, you can get there. # set up a blank plot par(mar=rep(0, 4)) par(bg="#cccccc") plot(NA,xlim=0:1,ylim=0:1) # define a function grad.circ <- function(centrex,centrey,radius,col,resolution) { colfunc <- colorRampPalette(col) shades <- colfunc(resolution) for (i in seq_along(shades) ) { clip( centrex - radius, centrex + radius, (centrey + radius) - ((i-1) * (radius*2)/length(shades)), (centrey + radius) - (i * (radius*2)/length(shades)) ) symbols( centrex, centrey, circles=radius, bg=shades[i], fg=NA, add=TRUE, inches=FALSE ) } } # call the function grad.circ(0.5,0.5,0.5,c("black", "white"),300) Result: EDIT (by Tyler Rinker): I wanted to add the rest

Categories : R

R: Gradient plot on a shapefile
Have you tried colorRampPalette? Here is how you could try to build a gradient palette gradient_color <- colorRampPalette(c("blue", "red")) gradient_color(10) [1] "#0000FF" "#1C00E2" "#3800C6" "#5500AA" "#71008D" "#8D0071" "#AA0055" [8] "#C60038" "#E2001C" "#FF0000" An example plot plot(rep(1,10),col=gradient_color(10))

Categories : R

Tile density plot by fill gradient with multiple colours
If you map fill to Type, and alpha to the density, you get more or less what you want: ggplot(dz, aes(x = Costs, y = 1, fill=Type)) + stat_density(aes(alpha=..density..), geom = "tile", position = "identity") + scale_fill_manual(values=c("red", "blue"))

Categories : R

How to render a mesh behind another mesh, like a mask?
This can be done using the stencil buffer. The stencil buffer gives each pixel some additional bits which can be used as a bitmask or a counter. In your case you'd configure the stencil test unit to set a specific bitmask when the depth test for the character fails (because it's obstructed by the well). Then you switch the stencil test mode operation to pass the stencil test for this specific bitmask, and render a full viewport, solid quad in the desired color, with depth testing and depth writes disabled. Code I strongly recommend you dive deep into the documentation for the stencil test unit. It's a very powerful mechanism, often overlooked. Your particular problem would be solved by the following. I stuggest you take this example code, read it in parallel to the stencil test functions

Categories : C++

CSS Gradient Background Stripes instead of Smooth gradient
The example page you provided works fine here in Google Chrome (v. 28.0.1500.95 m). I've inspected the site's source. The css they use is: #wrap { min-width: 600px; height: 100%; position: relative; background: -webkit-radial-gradient(#205983, #0A2742); background: radial-gradient(#205983, #0A2742); overflow: hidden; } Did you try using all the same css rules on your site? Mainly notice the height: 100%; rule. That might do something good.   Furthermore, the GPU and its settings on your machine might cause this problem to appear. But most of the time the problem originates from the rendering engine the browser uses. Sudden color-combinations don't harmonize, causing the shown effect. Try slightly different colors. Use the colorpicker in Google Chromes Inspector (the

Categories : HTML

How do I find the right gradient mix from looking at an image of a gradient?
This should be pretty accurate: background: #6ec0c7; /* Old browsers */ background: -moz-linear-gradient(top, #6ec0c7 0%, #62b5bc 50%, #58a9b1 99%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6ec0c7), color-stop(50%,#62b5bc), color-stop(99%,#58a9b1)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #6ec0c7 0%,#62b5bc 50%,#58a9b1 99%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #6ec0c7 0%,#62b5bc 50%,#58a9b1 99%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #6ec0c7 0%,#62b5bc 50%,#58a9b1 99%); /* IE10+ */ background: linear-gradient(to bottom, #6ec0c7 0%,#62b5bc 50%,#58a9b1 99%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6ec0c7

Categories : CSS

different result in -webkit-linear-gradient and -moz-linear-gradient
This generator should produce you the correct cross-browser code. You can use import from css button at the lower right corner of the generated css fieldset. For your code, this was the output: background: #696969; /* Old browsers */ background: -moz-linear-gradient(top, #696969 0%, #3d3d3d 50%, #292929 50%, #171717 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#696969), color-stop(50%,#3d3d3d), color-stop(50%,#292929), color-stop(100%,#171717)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #696969 0%,#3d3d3d 50%,#292929 50%,#171717 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #696969 0%,#3d3d3d 50%,#292929 50%,#171717 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #696969 0%,#3

Categories : CSS

core plot scatter plot x y axis label not being displayed correctly
Change any references to _hostView.hostedGraph.graph to _hostView.hostedGraph. The graph property is inherited from CPTLayer. It is used by other parts of the graph to maintain a pointer to the graph, but not by the graph itself.

Categories : IOS

How do I plot multiple data subset forecast predictions onto a single plot
This is answered in another post Is there an easy way to revert a forecast back into a time series for plotting? This was initially posted as two unique questions, but they have the same answer. The core question being addressed is "how to restore the original time stamps to the forecast data". What I have learned with trial and error is "configure, then never loose the time series attribute" by applying these steps: 1: Make a time series Use the ts() command and create a time series. 2: Subset a time series Use 'window()' to create a subset of the time series in 'for()' loop. Use 'start()' and 'end()' on the data to show the time axis positions. 3: Forecast a time series Use 'forecast()' or 'predict()' which operate on time series. 4: Plot a time series When you plot a time series, the

Categories : R

It is possible to have all the axes displayed in the ilnumerics surface plot without affecting the plot size?
The extend occupied by the plot cube data groups is controlled by the ILPlotCube.DataScreenRect property. It defines the data area of the plot cube rectangle only - ignoring the space used by labels and axes. The DataScreenRect is automatically adjusted by default - depending on the sizes of axes (fonts, text heights), ticks, and tick labels configuration. By defining the DataScreenRect area yourself, you risk that some of these elements will move outside the visible area. Therefore, to enable optimal visibility for all elements, you may adjust the properties for label positions, and ticks as well. DataScreenRect in the online manual: http://ilnumerics.net/advanced-configurations.html DataScreenRect in the class reference: http://ilnumerics.net/apidoc/html/P_ILNumerics_Drawing_Plott

Categories : Misc

Core plot- prevent zooming/scaling of plot to show full axes range
Is more a hint than an answer.. but, as I already said in comments: you can try to remove "scaleToFitPlots" and set xRange and yRange directly; or.. call -scaleToFitPlots: and then set the xRange afterwards

Categories : Iphone

Error while storing ggplots in list. Impossible to plot multiple ggplot, but possible to plot them seperately
Maybe you are looking for facet_wrap as Roland suggested. dat <- yourdata Get the mean and plot using facet_wrap moyparam<-ddply(dat, .(Date), function(x) data.frame(Mesure=mean(x$Mesure))) moyparam$Annee <- 1900 + as.POSIXlt(moyparam$Date)$year ggplot(moyparam, aes(Date, Mesure)) + geom_point() + theme_bw() + facet_wrap(~Annee, scales="free")

Categories : R

core-plot scatter plot not showing with only one data point
The -scaleToFitPlots: method doesn't have enough information from only one data point to calculate "reasonable" axis ranges. In that case, set the xRange and yRange yourself based on the data you do have.

Categories : IOS

Add axis label to plot in matplotlib, by passing them as arguments to plot()
As @nordev already explained, you cannot pass through plot() the axis label, but inside your function you can get the active figure and then set the axis labels like the example below: import matplotlib.pyplot as plt def plot_something(x, y, **kwargs): title = kwargs.pop( 'title' ) xlabel = kwargs.pop( 'xlabel' ) ylabel = kwargs.pop( 'ylabel' ) plt.figure() plt.plot(x, y, **kwargs) fig = plt.gcf() for axis in fig.axes: axis.set_title( title ) axis.xaxis.set_label( xlabel ) axis.yaxis.set_label( ylabel ) return axis plot_conf = {'title': 'Blabla', 'xlabel':'Time (s)', 'ylabel': 'Speed (m/s)'} x = [1.,2.,3.] y = [1.,4.,9.] axis = plot_something(x=x,y=y, **plot_conf)

Categories : Python

HighCharts range area plot not working when plot is inverted
Torstein at HighCharts has implemented a fix to this bug that is in his GitHub repo: https://github.com/highslide-software/highcharts.com/commit/905535d2c56d61d034eed84eccf50e3bb44e1911 And he's posted an example here: see http://jsfiddle.net/highcharts/Tt485/2/ I tried his fix and it worked perfectly. He's planning a maintenance release soon to post the fix.

Categories : Highcharts

How to create a pairs-plot (matrix-like plot) with `grid`?
I think you can divide the task in two main parts, like the basic examples in grid.panel() and grid.multipanel() 1- build a function that will produce a single panel, returned as a gTree. You need to figure out all the parameters, i.e. limits, axes, colours, shapes, grid, coordinates, ... You might end up rewriting lattice panel functions and axes, grid.newpage() grid::grid.panel(vp=viewport(width=0.8, height=0.8)) 2- assemble the panels in a layout. This is much easier (and cleaner) with gtable, library(gtable) grid.newpage() lg <- replicate(16, grobTree(rectGrob(), pointsGrob()), simplify=FALSE) gt <- gtable_matrix("pairs", grobs=matrix(lg, ncol=4), widths=unit(rep(1, 4), "null"), heights=unit(rep(1, 4), "null")) gt <- gtable_add

Categories : R

Legend does not match plot lines on MATLAB plot
The display of the red line as a full line is curious. In any case it's related to your plotting a vector against a scalar. This will plot equal length vectors and generate the behavior you expect: plot(y, g, '-k', y, P1*ones(1,length(y)), ':r', y, P3, '--b');

Categories : Matlab

ggplot overlay plot error, no layers in plot
You have to tell ggplot() which points to connect by lines. This is done by adding group=variable inside the aes(). ggplot(data = dat2, aes(x = Locs, y = value, colour = variable,group=variable)) + geom_line()

Categories : R

Matlab: Saving plot images, override plot.m
you can simply use the print command and save them into a directory that you can also make using the mkdir command. Sample code clc; close all; clear all; x = 1:10; y = x.^2; plot(x,y) if exist('plots','dir') ~= 7 mkdir('plots'); % make directory if it does not exist end print -dpdf ./plots/jawn.pdf Read the print documentation, to learn how to print in other file formats Also, I would not suggest overriding the plot command, and you will likely not be able to find the source code for plot.m because that is proprietary MATLAB code

Categories : Matlab

How to define the size of plot area with Core Plot
You haven't provided the sufficient information and the code in this question . But I think you can use the padding for that like : graph.plotAreaFrame.paddingBottom=25; graph.plotAreaFrame.paddingLeft=40; graph.plotAreaFrame.paddingRight=20; graph.plotAreaFrame.paddingTop=20; [graph applyTheme:[CPTTheme themeNamed:kCPTSlateTheme]];

Categories : IOS

Matplotlib: Scatter Plot to Foreground on top of a Contour Plot
You can manually choose in which order the different plots are to be displayed with the zorder parameter of e.g. the scatter method. To demonstrate, see the code below, where the scatter plot in the left subplot has zorder=1 and in the right subplot it has zorder=-1. The object with the highest zorder is placed on top. This means that the scatter will be placed on top of the contour in the first subplot, while it is placed underneath in the second subplot. import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt delta = 0.025 x = np.arange(-3.0, 3.0, delta) y = np.arange(-2.0, 2.0, delta) X, Y = np.meshgrid(x, y) Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) Z = 10.0 * (Z2 - Z1)

Categories : Python

How to plot a scatter plot using the histogram output in matplotlib?
I think your looking for the following: Essentially plt.hist() outputs two arrays (and as Nordev pointed out some patches). The first is the count in each bin (n) and the second the edges of the bin. import matplotlib.pylab as plt import numpy as np # Create some example data y = np.random.normal(5, size=1000) # Usual histogram plot fig = plt.figure() ax1 = fig.add_subplot(121) n, bins, patches = ax1.hist(y, bins=50) # output is two arrays # Scatter plot # Now we find the center of each bin from the bin edges bins_mean = [0.5 * (bins[i] + bins[i+1]) for i in range(len(n))] ax2 = fig.add_subplot(122) ax2.scatter(bins_mean, n) This is the best I can think of without some more description of the problem. Sorry if I misunderstood.

Categories : Python

ggplot2 geom_bar plot Labels fall outside plot
This seems to be a good solution for the previous example. I'll answer the question to leave the reference. z = ggplot(df_1, aes(x = factor(variable), y = value)) + geom_bar(data=df_1, stat = "identity", fill = col_bar) + geom_text(aes(label=value), colour= col_bar, size = 7, vjust = -1) z = z + theme(panel.background = element_blank()) z = z + theme(panel.border = element_blank()) z = z + theme(panel.grid.major = element_blank()) z = z + theme(panel.grid.minor = element_blank()) z = z + theme(panel.grid.major = element_blank()) z = z + theme(panel.grid.major.y = element_blank(), panel.grid.minor.y = element_blank()) z = z + theme(plot.background = element_blank()) z = z + theme(plot.background = element_blank()) z = z + theme(axis.text.y = element_blank()) z = z + theme(axis.tic

Categories : R

plotting the old data(for an earlier plot) again while making a new plot
You need to close or clear the plot between loops: eg. plt.close() cla() clears an axis, i.e. the currently active axis in the current figure. It leaves the other axes untouched. clf() clears the entire current figure with all its axes, but leaves the window opened, such that it may be reused for other plots. close() closes a window, which will be the current window, if not specified otherwise.

Categories : Python

How to plot errorbars on this plot and change the overlay?
Like this: tdat$x <- with(tdat,interaction(Condition,variable,drop=TRUE,sep='-')) tdat_err <- ddply(tdat,.(x), summarise,ymin = mean(value) - sd(value), ymax = mean(value) + sd(value)) ggplot(tdat, aes(x=x, y=value)) + stat_summary(fun.y='mean', geom='bar', aes(label=signif(..y..,4),fill=Condition)) + geom_point() + geom_errorbar(data = tdat_err,aes(x = x,ymin = ymin,ymax = ymax,y = NULL),width = 0.5) + labs(fill = 'Interaction Levels') I've cleaned up your code somewhat. You will run into fewer problems if you move any extraneous computations outside of your ggplot() call. Better to create the new x variable first. Everything is more readable that way too. The overlaying issue jus

Categories : R

How to plot grouped bar graph in core plot?
Use the barOffset property to shift the plots off the given bar location slightly. For example, with three plots, you might give the first plot an offset of -0.2, the second an offset of zero (the default), and the third an offset of +0.2, assuming your bars are one location unit apart.

Categories : IOS

Matlab; Scatter plot- shift the plot
Use the axis command: >> axis([0 1 0 1]); to set the limits of the axis (the range displayed). See axis doc for more info.

Categories : Matlab

How do I convert this ggplot2 bar plot to a line plot?
The issue was a missing group aesthetic. The function geom_line uses the factors as the default grouping variables (here, wday and splitter), and so each group is a single data point. Specifying the grouping in aes renders the lines as desired: ggplot(melt(temp,id.vars = c("wday","splitter")), aes(x = wday, y = value, colour = splitter, group = splitter)) + geom_point() + geom_line() + facet_grid(variable ~ ., scale = "free_y")

Categories : R

Core Plot - Plot label going beyond boundary
Add some padding to the graph and/or plot area frame (paddingLeft, paddingRight, etc.). This will push the plot area in away from the edges of the graph leaving room for the labels.

Categories : Iphone

save mesh with RGB in vtk
This is very awkward. Unlike vtkPolyDataXMLWriter and most other VTK writers, you must specify plyWriter->SetArrayName("Colors"); where your color array was created/named like this: vtkSmartPointer<vtkUnsignedCharArray> colors = vtkSmartPointer<vtkUnsignedCharArray>::New(); colors->SetNumberOfComponents(3); colors->SetName("Colors");

Categories : C++

Depth map to mesh
I read that OpenGL would be a good option. OpenGL is a good API if you want to draw that heightmap. However for simply doing mesh operations it's not the right thing. There are specially suited libraries for that kind of task. For example →GTS

Categories : Opengl

Get a gradient given a color where the color is in the middle of the gradient
If you want the gradient to start at white, go to your color, and then go to black, you can do it a number of ways. Here's one way: const int numEntries = 20; const int halfNumEntries = numEntries / 2; RGBColor gradient[numEntries]; HSVColor hsv = RGBToHSV (rgb); // Where rgb is the RGB color you start with // Gradient from white to your color for (int i = 0; i < halfNumEntries; i++) { float newHue = hsv.hue; float newSat = (i / halfNumEntries) * hsv.sat; float newVal = 1.0 + (i / halfNumEntries) * (hsv.val - 1.0); gradient [ i ] = HSVToRGB (newHue, newSat, newVal); } gradient [ halfNumEntries ] = rgb; // Gradient from your color to black for (int i = (halfNumEntries + 1); i < numEntries; i++) { float newHue = hsv.hue; float newSat = hsv.sat + ((i - halfNu

Categories : Algorithm

How to control yaw and pitch of mesh in Three.JS?
The yaw axis is the up axis, or y-axis in this case, so you need to rotate your spaceship geometry so it is level to begin with: geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) ); Then you need to change the eulerOrder of you spaceship so yaw (Y) is first and pitch (X) is second: spaceship.rotation.order = "YXZ"; // three.js r.65 Then you need to adjust your keycodes accordingly. three.js r.65

Categories : Javascript

How to mesh codeigniter with ajax
I'm not exactly sure what your saying your problem is. But This I do see. When trying to fetch a view for ajax you have to return the view as data http://ellislab.com/codeigniter/user-guide/general/views.html (bottom of the page) Like this $view = $this->load->view('includes/templates/main_page_template', $data, true); echo $view; This will send the rendered view to the browser

Categories : PHP

Error using mesh, matlab
At a guess, get( handles.funkcja , 'string' ) is returning a string. You can test this by checking whether f(1,2) returns ans = x.^2+y.^2 It should return ans = 5 You could potentially fix this problem with f = @(x,y)( eval(get( handles.funkcja , 'string' )) );

Categories : Matlab

How could I draw an Outlined Mesh like this?
I'm not familiar with LWJGL, but I think I may be able to point you in the right direction as far as the algorithm itself goes. You can plug Perlin/Simplex noise into a marching cubes algorithm and generate a triangle mesh from it. I used this technique to create this mesh: I believe you may be able to get the result you want by drawing the wireframe of the outputted mesh. After all, if you look closely, all of those lines make triangles. You can find more info about marching cubes here.

Categories : Java

XTK Flickering in Overlay mesh
That's the sorting algorithm screwing with you. When rendering transparent objects graphic engines like three.js or xtk like to sort the objects in the scene from back to front so the transparency is accumulated correctly (read more about it in 'Learning WebGL'). Due to your scene having one big transparent object inside another big transparent object with both having the same origin that sorting mechanism gets confused and starts flipping the objects between front and back. When the inner object is rendered first then the outer will blend its transparency with the inner, but when the outer is rendered first then the inner object will be ignored due to its surfaces lying behind the ones of the outer (depth testing). To solve this you may try to force the inner object to be rendered first

Categories : Misc

Issue in Coloring mesh in Three,js
Look at Color.js. There are a number of utilities you can use. For example, after you create your material you can reset the color like so: material.color.setStyle( "#ff0080" ); You can alternatively set the color correctly the first time using this pattern: var color = new THREE.Color( "#ff0080" ); var hex = color.getHex(); var material = new THREE.MeshBasicMaterial( { color: hex } ); three.js r.58

Categories : Javascript

3D Modeling for a game; only use one mesh?
What you can do is create your models from separate meshes, UV unwrap each one, texture it, apply it's material and then when you're done and only then, merge the meshes into one and link that one mesh to your armature. I think for blender it's Ctrl-J for joining. I know this doesn't necessarily answer your question but it's just what I would do.

Categories : IOS

Creating plane mesh
It's not clear if this is the root problem but you are doing integer arithmetic. float space = 40 / 200; always equals 0, i/199 always equals 0 for i < 199. That means your vertices look like: vertices[i] = new Vector3(-20 + i * 0, -6, 0); //Top vertices vertices[i+200] = new Vector3(-20 + i * 0, -10, 0); And UVs all look like: uvs[i] = new Vector2(0, 1); uvs[i+200] = new Vector2(0, 0); You could change float space = 40 / 200; to float space = (float)40 / 200; and i/199 to (float)i/199

Categories : C#



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