alpha

ggplot: adjusting alpha/fill two factors cdf

混江龙づ霸主 提交于 2019-12-05 09:47:27
I'm having some issues getting my ggplot alpha to be sufficiently dark for my plot. Example code: ggplot(mtcars, aes(x=mpg, color=factor(gear), alpha=factor(carb))) + stat_ecdf() As you can see, whenever carb == 1 , it's very difficult to see the plot elements. In my real world data set, the factor for color has four levels and the alpha factor has two levels. I was hoping to have the alpha a slightly lighter shade of the color, but more visible than how it's occurring in that example). You can adjust the alpha scale, as the user in the comment suggests, either by specifying a range or a

Telling ggplot NOT to scale alpha

爱⌒轻易说出口 提交于 2019-12-05 08:54:20
I would like to use the explicit values for the alpha level. head(D) x y group alpha 1 1 18 A 0.40 <~~~~ 2 2 18 A 0.44 3 3 18 A 0.47 4 1 18 A 0.51 5 2 21 B 0.55 6 3 21 B 0.58 ... However, ggplot is scaling the alpha levels. I can override this using scale_alpha_continuous(range=range(D$alpha)) , but this becomes a neusance when creating the graph programatically. Is there a direct way to tell ggplot NOT to scale alpha? (instead of telling it what range to scale to) Reproducible Exmple library(ggplot) library(gridExtra) (D <- data.frame(x=rep(1:3, 4), y=rep((6:8)*3, each=4), group=rep(c("A","B"

DCGAN的实现

蓝咒 提交于 2019-12-05 08:40:09
导入数据与模块 %matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat import tensorflow as tf network inputs def model_inputs(real_dim, z_dim): inputs_real = tf.placeholder(tf.float32, (None, *real_dim), name='input_real') inputs_z = tf.placeholder(tf.float32, (None, z_dim), name='input_z') return inputs_real, inputs_z generator def generator(z, output_dim, reuse=False, alpha=0.2, training=True): with tf.variable_scope('generator', reuse=reuse): # First fully connected layer x1 = tf.layers.dense(z, 4*4*512) # Reshape it to start the