Menu
  • HOME
  • TAGS

R : stat_smooth groups (x axis)

r,ggplot2,smooth,stat

the error message says to set group=1, doing that gives another error ggplot(dataset1, aes(x=Age, y=Scored.Probabilities, group=1))+stat_smooth() geom_smooth: method="auto" and size of largest group is >=1000, so using gam with formula: y ~ s(x, bs = "cs"). Use 'method = x' to change the smoothing method. Error in smooth.construct.cr.smooth.spec(object, data, knots)...

Smooth a density plot so that it doesn't appear saw toothed

r,smooth,smoothing,density-plot

you can make you density plot smoother by increasing the bandwidth (bw) plot(density(x$PLCO2, bw = bw_bigger)) ...

gaussian sum filter for irregular spaced points

python,numpy,scipy,gaussian,smooth

This will blow up for very large datasets, but the proper calculaiton you are asking for would be done as follows: import numpy as np import matplotlib.pyplot as plt np.random.seed(0) # for repeatability x = np.random.rand(30) x.sort() y = np.random.rand(30) x_eval = np.linspace(0, 1, 11) sigma = 0.1 delta_x =...

gaussian smoother in r

r,gaussian,smooth

Answer found in previous post - works great. f<-function(x, theta) { m<-theta[1]; s<-theta[2]; a<-theta[3]; b<-theta[4]; a*exp(-0.5*((x-m)/s)^2) + b } fit<-nls(y~f(x,c(m,s,a,b)), data.frame(x,y), start=list(m=12, s=5, a=12, b=-2)) ...

NearestNeighbors tradeoff - run faster with less accurate results

python,scikit-learn,smooth,nearest-neighbor

First of all, why to use a Ball tree? Maybe your metric does imply this to you, but if that's not the case, you could use a kd-tree too. I will approach your question from a theoretic point of view. The radius parameter is set 1.0 by default. This might...

smoothing outer edges in matplotlib

python,matplotlib,smooth,contourf

Answering the first question: You can smooth the contour values doing: zmin = Z1.min() zmax=Z1.max() levels=linspace(zmin, zmax, 400) and then pass levels as an argument to plt.contourf(). To smooth the outer edges you have to use more values in your 2-D grid, which can be achieved passing the number of...

How to output smooth cspline curve as a data file

output,gnuplot,smooth

This can be done by setting a table. Consider the following data file: 0 1 1 2 2 3 3 2 4 2 5 4 6 8 7 5 8 3 9 1 The data itself and its csplines interpolation look like this: To print the interpolation to a table...

How do I make two floating divs smoothly follows each other when moving using transition?

css,transition,sidebar,smooth

The easiest way is to just do a toggle a class on the body tag. For example .sidebar-open: .wrapper, .sidebar { transform: translateX(0); transition: all .5s ease-in-out; } .sidebar-open .wrapper, .sidebar-open .sidebar { transform: translateX(-200px); } ...

JQuery Jumpy Fading

javascript,fadein,fadeout,smooth

I think I know what your going for and went ahead and wrote a quick way to do it. You can see it here JsFiddle var showTime = 1000; // time before fade var fadeOutDuration = 300; var fadeInDuration = 500; var textIncrementer = 1; AnimateText(); function AnimateText() { setTimeout(function()...

Buttons (and other clips) getting pixeled or distorsioned when scaling down in flash

flash,air,smooth,lossless-compression,pixelate

If your bitmaps are set to smooth, it could be your stage's quality is set too low. stage.quality = StageQuality.MEDIUM; Is usually a good setting for bitmap smoothing....

How to smoothen data in Python?

python,numpy,scipy,smooth,smoothing

Use a larger smoothing parameter. For example, s=1000: tck = interpolate.splrep(x, y, k=3, s=1000) This produces: ...

gnuplot smooth bezier produces straight line segments

gnuplot,bezier,smooth

Try to set samples to higher value, for example set samples 10000 plot "data.dat" u 1 : 2 t "total bez" smooth bezier From gnuplot help: By default, sampling is set to 100 points. A higher sampling rate will produce more accurate plots, but will take longer. This parameter has...

How create gaps in smoother for “missing” values (R, ggplot)

r,ggplot2,smooth

I would create an expansion of the combinations of x and factor and then do a database-like join on the combinations and the data. For example, first I form a new data frame df with the combinations of the unique values of x and factor df <- expand.grid(sapply(data[, c("x", "factor")],...

Smooth scrolling within element, only first link/anchor works

jquery,scroll,smooth-scrolling,smooth

Fixed Script : <script> $(function() { $('a').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('#container').animate({ scrollTop: $('#container').scrollTop() + target.offset().top }, 1000); return false; } } }); }); </script> ...

How can I make my plot smoother in Python?

python,numpy,plot,scipy,smooth

One solution would be to use the scipy.iterp1D function with a 'cubic' type : from scipy import interpolate .... s_range = numpy.arange(0,21,1) for graph in graphs: cost = [] for s in s_range: cost.append(calculate_cost(s, graph.h, graph.d, graph.r, graph.k, graph.alphaR)) f = interpolate.interp1d(s_range, cost, kind='cubic') s_range_new = np.arange(0,20, 0.1) cost_new =...

how can I popup a text area using JQuery (nor input neither in another window)?

jquery,html,popup,textarea,smooth

$(function () { $("#trigger").click(function() { $(".text-hidden").toggleClass("text"); }); }); .text-hidden { transform: scaleX(0); transform-origin: 0% 40%; transition: all .5s ease; } .text { transform: scaleX(1); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button id="trigger" type="button">CLICK ME</button> <input type="text" class="text-hidden"></input> You can edit in CSS the way you will hide text area. (opacity, scale, transform,...

facet ggplot by span argument of loess smoother

r,ggplot2,smooth,loess

Your approach will work just fine if you explicitly print the plot (and get rid of your extra ' mark): for (s_i in s) { print(qplot(x, y, geom = c('point','smooth'), span = s_i)) } As for other ways to do it, I would recommend putting all your plots in a...

Three.js - How to smooth data like in d3.js

d3.js,three.js,smooth,interpolate

I've found the answer. With tween.js, i can do something very close to interpolate("basis") -> D3.js CatmullRom is the answer and the link is here -> array interpolation. More information about CatmullRom here...

POLYGON_SMOOTH in OpenGL doing wierd things

opengl,smooth

That is normal. You need 3 things for polygon smoothing to work properly: Draw your voxels from back-to-front when you use GL_POLYGON_SMOOTH. A framebuffer that stores destination alpha (e.g. RGBA not RGB) The blend function needs to be GL_SRC_ALPHA_SATURATE, GL_ONE If you account for all three of those things, the...

how to convert this into a smooth graph in matplotlib

python,matplotlib,smooth

The easiest way to get a smooth curve is probably fitting a polynomial. Below is an example for a polynomial fit of degree 3. import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 8, 1000) x_knots = list(range(0,9)) y_knots = [ 8.714871428, 8.618221961, 8.338674976, 7.904714805, 6.73505356, 6.08059523, 5.423472376,...

jQuery Smooth Scroll scrolls to wrong target when live (works on test page)

jquery,scroll,smooth,targets

The reason it isn't working properly is that the images are not yet fully loaded when document ready event fires. As a note document ready is when the DOM/html is ready for JS to execute however it does not guarantee the resources are loaded. As a result the targetOffset that...

Smooth scrolling within a div from a link in an image map

javascript,jquery,html,imagemap,smooth

I've edited your jsfiddle and I've added this $("area[shape='rect']").click(function(){ $('#thisdiv').animate({scrollTop: $("#thisdiv").prop("scrollHeight")}, 1000); }); I used simple jQuery with the "attribute equals selector", but probably you should give some id to the areas, like <map name="planetmap"> <area id="sun" shape="rect" coords="0,0,82,126" alt="Sun" href="#star"> <area id="mercury" shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm"> <area id="venus" shape="circle"...

Smoothing a 2-D figure

python,matplotlib,interpolation,smooth

Chaikin's corner cutting algorithm might be the ideal approach for you. For a given polygon with vertices as P0, P1, ...P(N-1), the corner cutting algorithm will generate 2 new vertices for each line segment defined by P(i) and P(i+1) as Q(i) = (3/4)P(i) + (1/4)P(i+1) R(i) = (1/4)P(i) + (3/4)P(i+1)...

Drawing soft brush

javascript,html5,canvas,smooth,brush

Using brushes Choose a brush, this can be an image with predefined brushes or you can make one using an off-screen canvas and draw a radial gradient into it. For simplicity I made a simple image brush such as these: Then for each new point drawn to the canvas: Calculate...

How to display a smoother gradient in HTML5 canvas?

html5,canvas,transition,gradient,smooth

Use a s-slope based gradient which could be defined using an ease-in-out function. This way the transition between flat and linear is smoothed out. You may need to compensate a little on the width as initial and final values are closer to the flat values than in the linear approach....

How can I create a searchbar like this?

css,animation,search,placeholder,smooth

Here is a simple example of how to style a search field in a similar manner as seen in your example. display: flex does most of the magic here, the rest is getting rid of backgrounds and borders or styling the submit button with an image For the typing animation...

(js) moving div x pixels smoothly with jquery or similar?

javascript,jquery,move,smooth

If you want to do this using only Javascript, you could also simply use an interval to update the css every xx number of milliseconds, for 60fps you'd use 16. (This is not the best way) var i = parseInt($("#Table_Middle1").css("top")); var animationLoop = setInterval(function() { i += 10; $("#Table_Middle1").css("top", i...