标签: gradient

IE7中的CSS背景渐变

我使用以下CSS来创建线性背景渐变.它似乎在IE8/9,FF,Safari和Chrome中工作得很好,但在IE7中却没有.IE7显示实心(绿色)背景.这是我的代码

.menu_body a {
  display:block;
  color:#006699;
  background: #008800;
  /* Mozilla: */
  background: -moz-linear-gradient(top, #0b71a4, #025f8e);
  /* Chrome, Safari:*/
  background: -webkit-gradient(linear,
            left top, left bottom, from(#0b71a4), to(#025f8e));
  /* MSIE */
  filter: progid:DXImageTransform.Microsoft.Gradient(
            StartColorStr='#0b71a4', EndColorStr='#025f8e', GradientType=0);
  padding: 1px 18px;
}   
Run Code Online (Sandbox Code Playgroud)

css gradient background internet-explorer-7

8
推荐指数
1
解决办法
2万
查看次数

Java 3 Color Gradient

我有一个JPanel,我想在其中绘制一个渐变.我有下面的代码,但只绘制了2色渐变.我想添加第3个但不知道如何.我想要的是让面板的左上角为白色,右上角为红色,两个底角为黑色.我需要做些什么来实现这一点,看起来像这样:

示例渐变

package pocketshop.util;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;

public class ColorPicker extends JPanel{

    public ColorPicker(){
        repaint();
    }

    @Override
    public void paintComponent(Graphics g){
        super.paintComponent(g);
        Graphics2D g2d = (Graphics2D)g;
        int w = getWidth();
        int h = getHeight();

        GradientPaint gp = new GradientPaint(
                0, 0, Color.white,
                0, h, Color.black);

        g2d.setPaint(gp);
        g2d.fillRect(0, 0, w, h);
    }
}
Run Code Online (Sandbox Code Playgroud)



编辑:可能的解决方案

我能够想出使用2个渐变,一个水平和一个垂直,像这样:

    public void paintComponent(Graphics g){
        super.paintComponent(g);
        Graphics2D g2d = (Graphics2D)g;
        int w = getWidth();
        int h = getHeight();

        // …
Run Code Online (Sandbox Code Playgroud)

java swing gradient image

8
推荐指数
2
解决办法
8884
查看次数

如何将渐变设置为TextView的文本颜色?

textgradient.xml我的drawable文件夹中有一个包含gradient()的文件.我需要将此渐变作为TextView通过Java 的文本颜色.怎么做?

java android gradient

8
推荐指数
1
解决办法
3万
查看次数

Theano是否为BPTT自动展开?

我正在Theano实施RNN,我很难训练它.它甚至没有记住训练语料库.我的错误很可能是由于我不能完全理解Theano如何应对随时间推移的反向传播.现在,我的代码非常简单:

grad_params = theano.tensor.grad(cost, params)
Run Code Online (Sandbox Code Playgroud)

我的问题是:鉴于我的网络是经常性的,这会自动将架构展开为前馈吗?一方面,这个例子正是我正在做的事情.另一方面,这个帖子让我觉得我错了.

如果它确实为我做了展开,我怎么能截断呢?我可以看到,从文档中有一种方法,scan但我无法想出代码来做到这一点.

python gradient backpropagation theano

8
推荐指数
1
解决办法
2428
查看次数

为负值和正值定义颜色渐变 scale_fill_gradientn()

R version 3.1.1 (2014-07-10) Platform: i386-w64-mingw32/i386 (32-bit)

我正在处理ggplot2()值从 -1 到 +1的热图。我想实现负值具有从深蓝色(-1)到浅蓝色(-0.00000001)的蓝色渐变和从浅红色(0.00000001)到深红色(1)的红色渐变。小值不应淡入白色,因为零应为白色,并且 0 和小值之间应有明显的对比度。NA 值应为灰色。

我试过了scale_fill_gradient2()scale_fill_gradientn()也用rescale().

已经讨论了一个类似的主题,但我无法解决我的问题:

是否可以在 scale_fill_gradient2() 中定义“中间”范围?

ggplot2正负值不同颜色渐变

数据(正负):

data.clean <- structure(list(`1` = c(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1
), `2` = c(-0.742791272678673, -0.637008381689233, -0.678722760290557, 
-0.374604178402531, -0.752540076766764, -0.741425721633379, -0.790950497422989, 
-0.822779886175826, -0.696227459496285, -0.698453447846652), 
`3` = c(-0.525688574069743, -0.43137330754352, -0.363377723970944, 
-0.210140400587573, -0.532475351847671, -0.587485278919413, 
-0.683607015861601, -0.630387125338536, -0.494214515339252, 
-0.566343042071197), `4` = c(-0.311771191820642, -0.320141843971631, 
-0.20021186440678, -0.0798166672550588, -0.369634479817365, 
-0.452880524911674, -0.526639098645571, -0.401771184676448, 
-0.278097123757212, -0.367096091610655), …
Run Code Online (Sandbox Code Playgroud)

plot gradient r rescale ggplot2

8
推荐指数
1
解决办法
7194
查看次数

如何在R中制作渐变色填充时间序列图

如何用渐变色填充下方(sp)线以下的区域?

这个例子是在Inkscape中绘制的 - 但我需要垂直渐变 - 不是水平的.

正的间隔==从白色红色.

负的间隔==从白色红色.

在此输入图像描述

有没有可以做到这一点的

我编造了一些源数据....

set.seed(1)
x<-seq(from = -10, to = 10, by = 0.25)
data <- data.frame(value = sample(x, 25, replace = TRUE), time = 1:25)
plot(data$time, data$value, type = "n")
my.spline <- smooth.spline(data$time, data$value, df = 15)
lines(my.spline$x, my.spline$y, lwd = 2.5, col = "blue")
abline(h = 0)
Run Code Online (Sandbox Code Playgroud)

gradient r time-series

8
推荐指数
4
解决办法
3327
查看次数

ggplot:如何在geom_polygon中生成渐变填充

这应该相当容易,但我找不到我的方式.

tri_fill <- structure(
  list(x= c(0.75, 0.75, 2.25, 3.25), 
       y = c(40, 43, 43, 40)), 
  .Names = c("x", "y"),
  row.names = c(NA, -4L), class = "data.frame",Integrated=NA, Related=NA)

# install.packages("ggplot2", dependencies = TRUE)
require(ggplot2)


  ggplot(data=tri_fill,aes(x=x, y=y))+ 
      geom_polygon() + 
      scale_fill_gradient(limits=c(1, 4), low = "lightgrey", high = "red")
Run Code Online (Sandbox Code Playgroud)

我想要的是沿着x轴的渐变,但是上面我只得到一个带有渐变的图例和带有实心填充的多边形.

情节

gradient r polygon ggplot2

8
推荐指数
1
解决办法
1993
查看次数

HTML/CSS - 线性渐变不占全屏

如果我的身体有以下 CSS 属性:

body {

 background-color: red;
 background-image: linear-gradient(red, orange);
}
Run Code Online (Sandbox Code Playgroud)

然后渐变出现在我的网页上,但它没有占据全屏尺寸(我有一个大显示器)。它显示如下: 这是页脚的问题吗?我目前没有页脚。

在此处输入图片说明

在此处输入图片说明

html css gradient background linear-gradients

8
推荐指数
2
解决办法
8114
查看次数

张量流梯度 - 获取所有 nan 值

我正在将 python 3 与 anaconda 一起使用,并将 tensorflow 1.12 与eager eval 一起使用。

我正在使用它为孪生网络创建三元组损失函数,并且需要计算不同数据样本之间的距离。

我创建了一个函数来创建距离计算,但是无论我做什么,当我尝试计算它相对于网络输出的梯度时,它一直给我所有的 nan 梯度。

这是代码:

def matrix_row_wise_norm(matrix):
    import tensorflow as tf
    tensor = tf.expand_dims(matrix, -1)

    tensor = tf.transpose(tensor, [0, 2, 1]) - tf.transpose(tensor, [2, 0, 1])
    norm = tf.norm(tensor, axis=2)
    return norm
Run Code Online (Sandbox Code Playgroud)

在我使用的损失函数中

def loss(y_true, p_pred):
    with tf.GradientTape() as t:
    t.watch(y_pred)
        distance_matrix = matrix_row_wise_norm(y_pred)
        grad = t.gradient(distance_matrix, y_pred)
Run Code Online (Sandbox Code Playgroud)

并且 grad 都是nans。我检查过它y_pred是由合法值组成的 - 确实如此。我试图创建一个y_pred * 2相对于自身的梯度并获得合法的梯度值。

我在这里缺少什么?创建距离矩阵时的索引是否有问题?


编辑:

两者的D型y_predlossIStf.float32 …

python gradient python-3.x deep-learning tensorflow

8
推荐指数
1
解决办法
4831
查看次数

如何制作带有渐变背景的 Flutter 应用栏

这个问题被张贴在这里,因为这里关于堆栈溢出的相关问题只有解决方法,但没有直截了当的方法。

gradient appbar flutter

8
推荐指数
2
解决办法
2050
查看次数