MATLAB, Filling in the area between two sets of data, lines in one figure

Building off of @gnovice’s answer, you can actually create filled plots with shading only in the area between the two curves. Just use fill in conjunction with fliplr. Example: x=0:0.01:2*pi; %#initialize x array y1=sin(x); %#create first curve y2=sin(x)+.5; %#create second curve X=[x,fliplr(x)]; %#create continuous x value array for plotting Y=[y1,fliplr(y2)]; %#create y values for out … Read more

How to fill a Path in Android with a linear gradient?

While steelbytes’ answer will probably give you more control over the individual sections of the gradient, you can do it without the path: Paint m_Paint = new Paint(); protected void onDraw(Canvas canvas) { super.onDraw(canvas); // start at 0,0 and go to 0,max to use a vertical // gradient the full height of the screen. m_Paint.setShader(new … Read more

Drawing a filled rectangle with a border in android

Try paint.setStyle(Paint.Style.FILL) and paint.setStyle(Paint.Style.STROKE). Paint paint = new Paint(); Rect r = new Rect(10, 10, 200, 100); @Override public void onDraw(Canvas canvas) { // fill paint.setStyle(Paint.Style.FILL); paint.setColor(Color.MAGENTA); canvas.drawRect(r, paint); // border paint.setStyle(Paint.Style.STROKE); paint.setColor(Color.BLACK); canvas.drawRect(r, paint); }

SVG fill color transparency / alpha?

You use an addtional attribute; fill-opacity: This attribute takes a decimal number between 0.0 and 1.0, inclusive; where 0.0 is completely transparent. For example: <rect … fill=”#044B94″ fill-opacity=”0.4″/> Additionally you have the following: stroke-opacity attribute for the stroke opacity for the entire object